aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-05-21 16:20:56 +0200
committerJosé Valim <jose.valim@gmail.com>2010-05-21 16:20:56 +0200
commitad4be3d75d46a04eb7a1d5a60bdfe68356a43e8b (patch)
tree1020a179182c3f329b7b9f0a321aadd0cd428672
parentcc45a1068f7920454d6d3a1cdabf844f17417908 (diff)
downloadrails-ad4be3d75d46a04eb7a1d5a60bdfe68356a43e8b.tar.gz
rails-ad4be3d75d46a04eb7a1d5a60bdfe68356a43e8b.tar.bz2
rails-ad4be3d75d46a04eb7a1d5a60bdfe68356a43e8b.zip
Fix failing test.
-rw-r--r--activerecord/test/cases/validations_test.rb12
-rw-r--r--activerecord/test/models/reply.rb6
2 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb
index 2a5e683f96..9527404f03 100644
--- a/activerecord/test/cases/validations_test.rb
+++ b/activerecord/test/cases/validations_test.rb
@@ -63,19 +63,19 @@ class ValidationsTest < ActiveRecord::TestCase
end
def test_error_on_given_context
- r = WrongReply.new
+ r = WrongReply.new(:title => "Valid title")
assert !r.valid?(:special_case)
- assert_equal "Invalid", r.errors[:title].join
+ assert_equal "Invalid", r.errors[:author_name].join
- r.title = "secret"
+ r.author_name = "secret"
r.content = "Good"
assert r.valid?(:special_case)
- r.title = nil
+ r.author_name = nil
assert !r.save(:context => :special_case)
- assert_equal "Invalid", r.errors[:title].join
+ assert_equal "Invalid", r.errors[:author_name].join
- r.title = "secret"
+ r.author_name = "secret"
assert r.save(:context => :special_case)
end
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb
index 6cc9ee038a..110d540120 100644
--- a/activerecord/test/models/reply.rb
+++ b/activerecord/test/models/reply.rb
@@ -17,7 +17,7 @@ class WrongReply < Reply
validate :check_empty_title
validate :check_content_mismatch, :on => :create
validate :check_wrong_update, :on => :update
- validate :check_title_is_secret, :on => :special_case
+ validate :check_author_name_is_secret, :on => :special_case
def check_empty_title
errors[:title] << "Empty" unless attribute_present?("title")
@@ -41,8 +41,8 @@ class WrongReply < Reply
errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update"
end
- def check_title_is_secret
- errors[:title] << "Invalid" unless title == "secret"
+ def check_author_name_is_secret
+ errors[:author_name] << "Invalid" unless author_name == "secret"
end
end