summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 6d6cf6dc8..1762de868 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -31,6 +31,7 @@ require File.expand_path(File.dirname(__FILE__) + '/object_helpers')
include ObjectHelpers
require 'net/ldap'
+require 'mocha/setup'
class ActionView::TestCase
helper :application
@@ -189,10 +190,18 @@ class ActiveSupport::TestCase
end
def assert_select_in(text, *args, &block)
- d = HTML::Document.new(CGI::unescapeHTML(String.new(text))).root
+ d = Nokogiri::HTML(CGI::unescapeHTML(String.new(text))).root
assert_select(d, *args, &block)
end
+ def assert_select_email(*args, &block)
+ email = ActionMailer::Base.deliveries.last
+ assert_not_nil email
+ html_body = email.parts.detect {|part| part.content_type.include?('text/html')}.try(&:body)
+ assert_not_nil html_body
+ assert_select_in html_body.encoded, *args, &block
+ end
+
def assert_mail_body_match(expected, mail, message=nil)
if expected.is_a?(String)
assert_include expected, mail_body(mail), message