diff options
Diffstat (limited to 'actionmailer/test/asset_host_test.rb')
-rw-r--r-- | actionmailer/test/asset_host_test.rb | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/actionmailer/test/asset_host_test.rb b/actionmailer/test/asset_host_test.rb index 32ae76a7c5..10cfdcf693 100644 --- a/actionmailer/test/asset_host_test.rb +++ b/actionmailer/test/asset_host_test.rb @@ -9,14 +9,10 @@ class AssetHostMailer < ActionMailer::Base end end -class AssetHostTest < ActiveSupport::TestCase +class AssetHostTest < ActionMailer::TestCase def setup - set_delivery_method :test - ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.deliveries.clear AssetHostMailer.configure do |c| c.asset_host = "http://www.example.com" - c.assets_dir = '' end end @@ -26,31 +22,16 @@ class AssetHostTest < ActiveSupport::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 AssetHostMailer.config.asset_host = Proc.new { |source| if source.starts_with?('/images') - "http://images.example.com" - else - "http://assets.example.com" + 'http://images.example.com' 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 - end - - def test_asset_host_as_two_argument_proc - ActionController::Base.config.asset_host = Proc.new {|source,request| - if request && request.ssl? - "https://www.example.com" - else - "http://www.example.com" - end - } - mail = nil - assert_nothing_raised { 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://images.example.com/images/somelogo.png" />}, mail.body.to_s.strip end end |