Module: ActiveRecord::Errors::Unique::Etest

Defined in:
lib/vex/active_record/validation_error_ext.rb

Defined Under Namespace

Classes: ErrorModels

Instance Method Summary collapse

Instance Method Details

#test_single_addsObject


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vex/active_record/validation_error_ext.rb', line 47

def test_single_adds
  obj = ErrorModels.new

  obj.errors.add "value", "xxx"
  assert_kind_of(String, obj.errors["value"])

  obj.errors.add "value", "xxx"
  assert_kind_of(String, obj.errors["value"])

  obj.errors.add "value", "yyyy"
  assert_equal(%w(xxx yyyy), obj.errors["value"])

  obj.errors.add "value", "yyyy"
  assert_equal(%w(xxx yyyy), obj.errors["value"])

  obj.errors.add "value", "xxx"
  assert_equal(%w(xxx yyyy), obj.errors["value"])

  obj.errors.add "value", "zzz"
  assert_equal(%w(xxx yyyy zzz), obj.errors["value"])
end