Namespace
Methods
Instance Public methods
assert_url_for(expected, options, relative = false)
Link
# File actionmailer/test/url_test.rb, line 66 def assert_url_for(expected, options, relative = false) expected = "http://www.basecamphq.com#{expected}" if expected.start_with?('/') && !relative urls = UrlTestMailer.exercise_url_for(options).body.to_s.chomp.split assert_equal expected, urls.first assert_equal expected, urls.second end
encode( text, charset="UTF-8" )
Link
new_mail( charset="UTF-8" )
Link
setup()
Link
test_signed_up_with_url()
Link
# File actionmailer/test/url_test.rb, line 107 def test_signed_up_with_url UrlTestMailer.delivery_method = :test AppRoutes.draw do get ':controller(/:action(/:id))' get '/welcome' => "foo#bar", as: "welcome" end expected = new_mail expected.to = @recipient expected.subject = "[Signed up] Welcome #{@recipient}" expected.body = "Hello there,\n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome\n\n<img alt=\"Somelogo\" src=\"/images/somelogo.png\" />" expected.from = "system@loudthinking.com" expected.date = Time.local(2004, 12, 12) expected.content_type = "text/html" created = nil assert_nothing_raised { created = UrlTestMailer.signed_up_with_url(@recipient) } assert_not_nil created expected.message_id = '<123@456>' created.message_id = '<123@456>' 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_dom_equal expected.encoded, delivered.encoded end
test_url_for()
Link
# File actionmailer/test/url_test.rb, line 78 def test_url_for UrlTestMailer.delivery_method = :test AppRoutes.draw do get ':controller(/:action(/:id))' get '/welcome' => 'foo#bar', as: 'welcome' get '/dummy_model' => 'foo#baz', as: 'dummy_model' end # string assert_url_for 'http://foo/', 'http://foo/' # symbol assert_url_for '/welcome', :welcome # hash assert_url_for '/a/b/c', controller: 'a', action: 'b', id: 'c' assert_url_for '/a/b/c', {controller: 'a', action: 'b', id: 'c', only_path: true}, true # model assert_url_for '/dummy_model', DummyModel.new # class assert_url_for '/dummy_model', DummyModel # array assert_url_for '/dummy_model' , [DummyModel] end