diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-24 22:56:20 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-24 22:56:30 -0700 |
commit | 38e056ee2ae97450f509348442190f21bfc45a54 (patch) | |
tree | 9bfb0b29c6520aa01473503733ddf577f8b1b54c | |
parent | f430d6b63e5a756cf248e92d87a61a505034600c (diff) | |
download | rails-38e056ee2ae97450f509348442190f21bfc45a54.tar.gz rails-38e056ee2ae97450f509348442190f21bfc45a54.tar.bz2 rails-38e056ee2ae97450f509348442190f21bfc45a54.zip |
Use ActiveModel::TestCase base class
-rw-r--r-- | activemodel/lib/active_model/lint.rb | 6 | ||||
-rw-r--r-- | activemodel/test/cases/lint_test.rb | 4 | ||||
-rw-r--r-- | activemodel/test/cases/naming_test.rb | 2 | ||||
-rw-r--r-- | activemodel/test/cases/validations/i18n_generate_message_validation_test.rb | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/activemodel/lib/active_model/lint.rb b/activemodel/lib/active_model/lint.rb index 478f887043..ceaa29dc8c 100644 --- a/activemodel/lib/active_model/lint.rb +++ b/activemodel/lib/active_model/lint.rb @@ -1,6 +1,3 @@ -require "test/unit" -require "test/unit/ui/console/testrunner" - # You can test whether an object is compliant with the ActiveModel API by # calling ActiveModel::Lint.test(object). It will emit a Test::Unit # output that tells you whether your object is fully compliant, or if not, @@ -16,6 +13,9 @@ require "test/unit/ui/console/testrunner" module ActiveModel module Lint def self.test(object, verbosity = 2, output = STDOUT) + require "test/unit" + require "test/unit/ui/console/testrunner" + test_class = Class.new(::Test::Unit::TestCase) do include Test diff --git a/activemodel/test/cases/lint_test.rb b/activemodel/test/cases/lint_test.rb index 165c353045..ed576a91e2 100644 --- a/activemodel/test/cases/lint_test.rb +++ b/activemodel/test/cases/lint_test.rb @@ -1,6 +1,6 @@ require "cases/helper" -class TestLint < Test::Unit::TestCase +class TestLint < ActiveModel::TestCase class CompliantObject def to_model self @@ -47,4 +47,4 @@ class TestLint < Test::Unit::TestCase def test_errors_full_messages assert_output(CompliantObject.new, 0, 0, /test_errors_aref/) end -end
\ No newline at end of file +end diff --git a/activemodel/test/cases/naming_test.rb b/activemodel/test/cases/naming_test.rb index e75d4541a3..4d97af3d13 100644 --- a/activemodel/test/cases/naming_test.rb +++ b/activemodel/test/cases/naming_test.rb @@ -1,6 +1,6 @@ require 'cases/helper' -class NamingTest < Test::Unit::TestCase +class NamingTest < ActiveModel::TestCase def setup @model_name = ActiveModel::Name.new('Post::TrackBack') end diff --git a/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb b/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb index 07e4341289..443a81c6ac 100644 --- a/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb @@ -3,7 +3,7 @@ require 'cases/tests_database' require 'models/person' -class I18nGenerateMessageValidationTest < Test::Unit::TestCase +class I18nGenerateMessageValidationTest < ActiveModel::TestCase def setup Person.reset_callbacks(:validate) @person = Person.new |