aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-05-18 21:47:24 -0400
committerJosé Valim <jose.valim@gmail.com>2010-05-19 10:18:36 +0200
commitb4629528866446aa59f663a1162edbdacee85600 (patch)
treed68a0f440d552285adf99b462b8bde39d346aaa6 /actionmailer
parentb753b4a076d7067efccbd1ad384829f77e62a064 (diff)
downloadrails-b4629528866446aa59f663a1162edbdacee85600.tar.gz
rails-b4629528866446aa59f663a1162edbdacee85600.tar.bz2
rails-b4629528866446aa59f663a1162edbdacee85600.zip
Use better assertion methods for testing
[#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/test/base_test.rb4
-rw-r--r--actionmailer/test/old_base/asset_host_test.rb8
-rw-r--r--actionmailer/test/old_base/mail_render_test.rb2
-rw-r--r--actionmailer/test/old_base/mail_service_test.rb22
-rw-r--r--actionmailer/test/test_helper_test.rb4
5 files changed, 20 insertions, 20 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 5506d62d6a..54bf3de6af 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -491,8 +491,8 @@ class BaseTest < ActiveSupport::TestCase
# Class level API with method missing
test "should respond to action methods" do
- assert BaseMailer.respond_to?(:welcome)
- assert BaseMailer.respond_to?(:implicit_multipart)
+ assert_respond_to BaseMailer, :welcome
+ assert_respond_to BaseMailer, :implicit_multipart
assert !BaseMailer.respond_to?(:mail)
assert !BaseMailer.respond_to?(:headers)
end
diff --git a/actionmailer/test/old_base/asset_host_test.rb b/actionmailer/test/old_base/asset_host_test.rb
index 0ec0242f55..cc13c8a4d7 100644
--- a/actionmailer/test/old_base/asset_host_test.rb
+++ b/actionmailer/test/old_base/asset_host_test.rb
@@ -26,7 +26,7 @@ class AssetHostTest < Test::Unit::TestCase
def test_asset_host_as_string
mail = AssetHostMailer.email_with_asset
- assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.to_s.strip
+ assert_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_arguement_proc
@@ -38,7 +38,7 @@ class AssetHostTest < Test::Unit::TestCase
end
}
mail = AssetHostMailer.email_with_asset
- assert_equal "<img alt=\"Somelogo\" src=\"http://images.example.com/images/somelogo.png\" />", mail.body.to_s.strip
+ 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_arguement_proc
@@ -51,6 +51,6 @@ class AssetHostTest < Test::Unit::TestCase
}
mail = nil
assert_nothing_raised { mail = AssetHostMailer.email_with_asset }
- assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.to_s.strip
+ assert_equal %Q{<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />}, mail.body.to_s.strip
end
-end \ No newline at end of file
+end
diff --git a/actionmailer/test/old_base/mail_render_test.rb b/actionmailer/test/old_base/mail_render_test.rb
index 405d43d7d3..08951833a5 100644
--- a/actionmailer/test/old_base/mail_render_test.rb
+++ b/actionmailer/test/old_base/mail_render_test.rb
@@ -117,7 +117,7 @@ class RenderHelperTest < Test::Unit::TestCase
def test_rxml_template
mail = RenderMailer.rxml_template.deliver
- assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.to_s.strip
+ assert_equal %(<?xml version="1.0" encoding="UTF-8"?>\n<test/>), mail.body.to_s.strip
end
def test_included_subtemplate
diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb
index f343d32019..7054e8052a 100644
--- a/actionmailer/test/old_base/mail_service_test.rb
+++ b/actionmailer/test/old_base/mail_service_test.rb
@@ -281,7 +281,7 @@ class TestMailer < ActionMailer::Base
from "One: Two <test@example.com>"
cc "Three: Four <test@example.com>"
bcc "Five: Six <test@example.com>"
- body "testing"
+ body "testing"
end
def custom_content_type_attributes
@@ -289,7 +289,7 @@ class TestMailer < ActionMailer::Base
subject "custom content types"
from "some.one@somewhere.test"
content_type "text/plain; format=flowed"
- body "testing"
+ body "testing"
end
def return_path
@@ -297,7 +297,7 @@ class TestMailer < ActionMailer::Base
subject "return path test"
from "some.one@somewhere.test"
headers["return-path"] = "another@somewhere.test"
- body "testing"
+ body "testing"
end
def subject_with_i18n(recipient)
@@ -417,7 +417,7 @@ class ActionMailerTest < Test::Unit::TestCase
end
def test_custom_template
- expected = new_mail
+ expected = new_mail
expected.to = @recipient
expected.subject = "[Signed up] Welcome #{@recipient}"
expected.body = "Hello there, \n\nMr. #{@recipient}"
@@ -436,7 +436,7 @@ class ActionMailerTest < Test::Unit::TestCase
assert ActionView::Template.template_handler_extensions.include?("haml"), "haml extension was not registered"
# N.b., custom_templating_extension.text.plain.haml is expected to be in fixtures/test_mailer directory
- expected = new_mail
+ expected = new_mail
expected.to = @recipient
expected.subject = "[Signed up] Welcome #{@recipient}"
expected.body = "Hello there, \n\nMr. #{@recipient}"
@@ -453,7 +453,7 @@ class ActionMailerTest < Test::Unit::TestCase
end
def test_cancelled_account
- expected = new_mail
+ expected = new_mail
expected.to = @recipient
expected.subject = "[Cancelled] Goodbye #{@recipient}"
expected.body = "Goodbye, Mr. #{@recipient}"
@@ -477,7 +477,7 @@ class ActionMailerTest < Test::Unit::TestCase
end
def test_cc_bcc
- expected = new_mail
+ expected = new_mail
expected.to = @recipient
expected.subject = "testing bcc/cc"
expected.body = "Nothing to see here."
@@ -602,7 +602,7 @@ class ActionMailerTest < Test::Unit::TestCase
def test_unencoded_subject
TestMailer.delivery_method = :test
- expected = new_mail
+ expected = new_mail
expected.to = @recipient
expected.subject = "testing unencoded subject"
expected.body = "Nothing to see here."
@@ -1151,15 +1151,15 @@ class RespondToTest < Test::Unit::TestCase
end
def test_should_respond_to_new
- assert RespondToMailer.respond_to?(:new)
+ assert_respond_to RespondToMailer, :new
end
def test_should_respond_to_create_with_template_suffix
- assert RespondToMailer.respond_to?(:create_any_old_template)
+ assert_respond_to RespondToMailer, :create_any_old_template
end
def test_should_respond_to_deliver_with_template_suffix
- assert RespondToMailer.respond_to?(:deliver_any_old_template)
+ assert_respond_to RespondToMailer, :deliver_any_old_template
end
def test_should_not_respond_to_new_with_template_suffix
diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb
index 440fb868c8..8ff604c2c7 100644
--- a/actionmailer/test/test_helper_test.rb
+++ b/actionmailer/test/test_helper_test.rb
@@ -18,7 +18,7 @@ class TestHelperMailerTest < ActionMailer::TestCase
end
def test_setup_creates_the_expected_mailer
- assert @expected.is_a?(Mail::Message)
+ assert_kind_of Mail::Message, @expected
assert_equal "1.0", @expected.mime_version
assert_equal "text/plain", @expected.mime_type
end
@@ -121,7 +121,7 @@ class AnotherTestHelperMailerTest < ActionMailer::TestCase
end
def test_setup_shouldnt_conflict_with_mailer_setup
- assert @expected.is_a?(Mail::Message)
+ assert_kind_of Mail::Message, @expected
assert_equal 'a value', @test_var
end
end