aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-17 10:04:07 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-17 10:04:07 +0000
commitd5b67ed8d33dbde44d24d7d93135261062e550d1 (patch)
treea034208841067902096469abedb12cc8e304cfdd /activerecord/test
parent154668898aadef2d98093cd3c2b7c895fff8b7a6 (diff)
downloadrails-d5b67ed8d33dbde44d24d7d93135261062e550d1.tar.gz
rails-d5b67ed8d33dbde44d24d7d93135261062e550d1.tar.bz2
rails-d5b67ed8d33dbde44d24d7d93135261062e550d1.zip
Added the option to specify the acceptance string in validates_acceptance_of #1106 [caleb@aei-tech.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/validations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb
index 30de66c94b..736cad140a 100755
--- a/activerecord/test/validations_test.rb
+++ b/activerecord/test/validations_test.rb
@@ -189,6 +189,17 @@ class ValidationsTest < Test::Unit::TestCase
assert t.save
end
+ def test_terms_of_service_agreement_with_accept_value
+ Topic.validates_acceptance_of(:terms_of_service, :on => :create, :accept => "I agree.")
+
+ t = Topic.create("title" => "We should be confirmed", "terms_of_service" => "")
+ assert !t.save
+ assert_equal "must be accepted", t.errors.on(:terms_of_service)
+
+ t.terms_of_service = "I agree."
+ assert t.save
+ end
+
def test_validate_presences
Topic.validates_presence_of(:title, :content)