def test_check_valid_length
key = "k"
val = "v"
- (1..255).each do |i|
+ [1, 255].each do |i|
up = UserPreference.new
up.user = create(:user)
up.k = key * i
up.user = create(:user)
up.k = key * i
up.v = val * i
- assert_equal false, up.valid?
+ assert_not up.valid?
assert_raise(ActiveRecord::RecordInvalid) { up.save! }
end
end