aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/cases/validations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/test/cases/validations_test.rb')
-rw-r--r--activeresource/test/cases/validations_test.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/activeresource/test/cases/validations_test.rb b/activeresource/test/cases/validations_test.rb
index 82546424f2..3b1caecb04 100644
--- a/activeresource/test/cases/validations_test.rb
+++ b/activeresource/test/cases/validations_test.rb
@@ -3,7 +3,7 @@ require 'fixtures/project'
require 'active_support/core_ext/hash/conversions'
# The validations are tested thoroughly under ActiveModel::Validations
-# This test case simply makes sur that they are all accessible by
+# This test case simply makes sure that they are all accessible by
# Active Resource objects.
class ValidationsTest < ActiveModel::TestCase
VALID_PROJECT_HASH = { :name => "My Project", :description => "A project" }
@@ -24,7 +24,7 @@ class ValidationsTest < ActiveModel::TestCase
assert p.save, "should have saved after fixing the validation, but had: #{p.errors.inspect}"
end
-
+
def test_fails_save!
p = new_project(:name => nil)
assert_raise(ActiveResource::ResourceInvalid) { p.save! }
@@ -36,14 +36,6 @@ class ValidationsTest < ActiveModel::TestCase
assert p.save(:validate => false)
end
- def test_deprecated_save_without_validation
- p = new_project(:name => nil)
- assert !p.save
- assert_deprecated do
- assert p.save(false)
- end
- end
-
def test_validate_callback
# we have a callback ensuring the description is longer than three letters
p = new_project(:description => 'a')
@@ -56,6 +48,12 @@ class ValidationsTest < ActiveModel::TestCase
assert p.save, "should have saved after fixing the validation, but had: #{p.errors.inspect}"
end
+ def test_client_side_validation_maximum
+ project = Project.new(:description => '123456789012345')
+ assert ! project.valid?
+ assert_equal ['is too long (maximum is 10 characters)'], project.errors[:description]
+ end
+
protected
# quickie helper to create a new project with all the required