mirror of https://github.com/rails/rails
Merge pull request #17204 from schneems/schneems/fix-am-tests-master
fix tests on action_mailer
This commit is contained in:
commit
2b3d67d64b
|
@ -16,7 +16,7 @@ module ActionMailer
|
|||
|
||||
include ActiveSupport::Testing::ConstantLookup
|
||||
include TestHelper
|
||||
include Rails::Dom::Testing::Assertions::SelectorAssertions
|
||||
include Rails::Dom::Testing::Assertions
|
||||
|
||||
included do
|
||||
class_attribute :_mailer_class
|
||||
|
|
|
@ -22,7 +22,7 @@ class AssetHostTest < ActionMailer::TestCase
|
|||
|
||||
def test_asset_host_as_string
|
||||
mail = AssetHostMailer.email_with_asset
|
||||
assert_equal %Q{<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />}, mail.body.to_s.strip
|
||||
assert_dom_equal %Q{<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />}, mail.body.to_s.strip
|
||||
end
|
||||
|
||||
def test_asset_host_as_one_argument_proc
|
||||
|
@ -32,6 +32,6 @@ class AssetHostTest < ActionMailer::TestCase
|
|||
end
|
||||
}
|
||||
mail = AssetHostMailer.email_with_asset
|
||||
assert_equal %Q{<img alt="Somelogo" src="http://images.example.com/images/somelogo.png" />}, mail.body.to_s.strip
|
||||
assert_dom_equal %Q{<img alt="Somelogo" src="http://images.example.com/images/somelogo.png" />}, mail.body.to_s.strip
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,8 @@ require 'mailers/proc_mailer'
|
|||
require 'mailers/asset_mailer'
|
||||
|
||||
class BaseTest < ActiveSupport::TestCase
|
||||
include Rails::Dom::Testing::Assertions
|
||||
|
||||
setup do
|
||||
@original_delivery_method = ActionMailer::Base.delivery_method
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
|
@ -536,7 +538,7 @@ class BaseTest < ActiveSupport::TestCase
|
|||
|
||||
mail = AssetMailer.welcome
|
||||
|
||||
assert_equal(%{<img alt="Dummy" src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip)
|
||||
assert_dom_equal(%{<img alt="Dummy" src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip)
|
||||
end
|
||||
|
||||
test "assets tags should use a Mailer's asset_host settings when available" do
|
||||
|
@ -550,7 +552,7 @@ class BaseTest < ActiveSupport::TestCase
|
|||
|
||||
mail = TempAssetMailer.welcome
|
||||
|
||||
assert_equal(%{<img alt="Dummy" src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip)
|
||||
assert_dom_equal(%{<img alt="Dummy" src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip)
|
||||
end
|
||||
|
||||
test 'the view is not rendered when mail was never called' do
|
||||
|
|
|
@ -66,13 +66,13 @@ class ActionMailerUrlTest < ActionMailer::TestCase
|
|||
|
||||
expected.message_id = '<123@456>'
|
||||
created.message_id = '<123@456>'
|
||||
assert_equal expected.encoded, created.encoded
|
||||
assert_dom_equal expected.encoded, created.encoded
|
||||
|
||||
assert_nothing_raised { UrlTestMailer.signed_up_with_url(@recipient).deliver_now }
|
||||
assert_not_nil ActionMailer::Base.deliveries.first
|
||||
delivered = ActionMailer::Base.deliveries.first
|
||||
|
||||
delivered.message_id = '<123@456>'
|
||||
assert_equal expected.encoded, delivered.encoded
|
||||
assert_dom_equal expected.encoded, delivered.encoded
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue