diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 22:34:46 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 22:34:46 +0000 |
commit | 18c663eb126c9adc11852dbbc1a1fa2f9e05aa28 (patch) | |
tree | a8faab48687d438c21ff9caf05a7b359a41016e8 /activerecord/test | |
parent | 8a59ee921aa00ac7875afb5525d793694b1e8fe8 (diff) | |
download | rails-18c663eb126c9adc11852dbbc1a1fa2f9e05aa28.tar.gz rails-18c663eb126c9adc11852dbbc1a1fa2f9e05aa28.tar.bz2 rails-18c663eb126c9adc11852dbbc1a1fa2f9e05aa28.zip |
Allow validates_acceptance_of to use a real attribute instead of only virtual (so you can record that the acceptance occured) (closes #7457) [ambethia]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8208 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/validations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 03d5da4990..263aba7747 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -25,6 +25,10 @@ class UniqueReply < Reply validates_uniqueness_of :content, :scope => 'parent_id' end +class PlagiarizedReply < Reply + validates_acceptance_of :author_name +end + class SillyUniqueReply < UniqueReply end @@ -292,6 +296,11 @@ class ValidationsTest < Test::Unit::TestCase assert t.save end + def test_validates_acceptance_of_as_database_column + reply = PlagiarizedReply.create("author_name" => "Dan Brown") + assert_equal "Dan Brown", reply["author_name"] + end + def test_validate_presences Topic.validates_presence_of(:title, :content) |