Use ActiveModel::TestCase base class
This commit is contained in:
parent
f430d6b63e
commit
38e056ee2a
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue