Namespace
Methods
T
Instance Public methods
test_can_be_instantiated_with_no_args()
# File activerecord/test/cases/errors_test.rb, line 4
def test_can_be_instantiated_with_no_args
  base = ActiveRecord::ActiveRecordError
  error_klasses = ObjectSpace.each_object(Class).select { |klass| klass < base }

  error_klasses.each do |error_klass|
    begin
      error_klass.new.inspect
    rescue ArgumentError
      raise "Instance of #{error_klass} can't be initialized with no arguments"
    end
  end
end
test_delete()
# File activemodel/test/cases/errors_test.rb, line 30
def test_delete
  errors = ActiveModel::Errors.new(self)
  errors[:foo] << 'omg'
  errors.delete(:foo)
  assert_empty errors[:foo]
end
test_dup()
# File activemodel/test/cases/errors_test.rb, line 43
def test_dup
  errors = ActiveModel::Errors.new(self)
  errors[:foo] << 'bar'
  errors_dup = errors.dup
  errors_dup[:bar] << 'omg'
  assert_not_same errors_dup.messages, errors.messages
end
test_has_key?()
# File activemodel/test/cases/errors_test.rb, line 51
def test_has_key?
  errors = ActiveModel::Errors.new(self)
  errors[:foo] << 'omg'
  assert_equal true, errors.has_key?(:foo), 'errors should have key :foo'
end
test_has_no_key()
# File activemodel/test/cases/errors_test.rb, line 57
def test_has_no_key
  errors = ActiveModel::Errors.new(self)
  assert_equal false, errors.has_key?(:name), 'errors should not have key :name'
end
test_include?()
# File activemodel/test/cases/errors_test.rb, line 37
def test_include?
  errors = ActiveModel::Errors.new(self)
  errors[:foo] << 'omg'
  assert errors.include?(:foo), 'errors should include :foo'
end
test_key?()
# File activemodel/test/cases/errors_test.rb, line 62
def test_key?
  errors = ActiveModel::Errors.new(self)
  errors[:foo] << 'omg'
  assert_equal true, errors.key?(:foo), 'errors should have key :foo'
end
test_no_key()
# File activemodel/test/cases/errors_test.rb, line 68
def test_no_key
  errors = ActiveModel::Errors.new(self)
  assert_equal false, errors.key?(:name), 'errors should not have key :name'
end