Browse files

Fix tests running under Rails 3.1 and 3.2

AM::TestCase and AV::TestCase have different semantics in 3.2, so add checks.
  • Loading branch information...
1 parent afaea76 commit cdd8a58bf534fb989f7ffce1144b98faf30c68b1 @blowmage committed Sep 23, 2012
Showing with 10 additions and 8 deletions.
  1. +8 −6 test/rails/action_mailer/test_mailers.rb
  2. +2 −2 test/rails/action_view/test_helpers.rb
View
14 test/rails/action_mailer/test_mailers.rb
@@ -6,6 +6,7 @@
class TestTestMailer < ActionMailer::Base; end
+# From Rails...
class CrazyNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
tests TestTestMailer
@@ -20,16 +21,17 @@ class CrazySymbolNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
def test_set_mailer_class_manual_using_symbol
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
class CrazyStringNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
tests 'test_test_mailer'
def test_set_mailer_class_manual_using_string
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
+# New tests...
describe TestTestMailer do
it "gets the mailer from the test name" do
assert_equal TestTestMailer, self.class.mailer_class
@@ -76,15 +78,15 @@ def test_set_mailer_class_manual_using_string
it "gets the mailer after setting it with a symbol" do
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
describe "AnotherCrazyStringNameMailerTest" do
tests 'test_test_mailer'
it "gets the mailer after setting it with a string" do
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
describe "Another Crazy Name Mailer Test" do
tests TestTestMailer
@@ -100,12 +102,12 @@ def test_set_mailer_class_manual_using_string
it "gets the mailer after setting it with a symbol" do
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
describe "Another Crazy String Name Mailer Test" do
tests 'test_test_mailer'
it "gets the mailer after setting it with a string" do
assert_equal TestTestMailer, self.class.mailer_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
View
4 test/rails/action_view/test_helpers.rb
@@ -36,15 +36,15 @@ class CrazySymbolHelperTest < MiniTest::Rails::ActionView::TestCase
def test_set_helper_class_using_symbol
assert_equal PeopleHelper, self.class.helper_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
class CrazyStringHelperTest < MiniTest::Rails::ActionView::TestCase
tests 'people'
def test_set_helper_class_using_string
assert_equal PeopleHelper, self.class.helper_class
end
-end
+end if Rails::VERSION::STRING >= "3.2"
# New tests...
describe PeopleHelper do

0 comments on commit cdd8a58

Please sign in to comment.