Skip to content

Commit

Permalink
Fix accessible/protected tests after change to update_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Jan 7, 2012
1 parent 24f5659 commit 21ce488
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions test/functional/test_accessible.rb
Expand Up @@ -68,9 +68,9 @@ class AccessibleTest < Test::Unit::TestCase
doc.name.should == 'John'
end

should "ignore inaccessible attribute on #update_attribute" do
should "not ignore inaccessible attribute on #update_attribute" do
@doc.update_attribute('admin', true)
@doc.admin.should be_false
@doc.admin.should be_true
end

should "ignore inaccessible attribute on #update_attributes" do
Expand Down
6 changes: 3 additions & 3 deletions test/functional/test_protected.rb
Expand Up @@ -76,7 +76,7 @@ class ProtectedTest < Test::Unit::TestCase

should "ignore protected attribute on #update_attribute" do
@doc.update_attribute('admin', true)
@doc.admin.should be_false
@doc.admin.should be_true
end

should "ignore protected attribute on #update_attributes" do
Expand Down Expand Up @@ -181,9 +181,9 @@ class ::OtherChild < ::GrandParent
@edoc.admin.should be_true
end

should "ignore protected attribute on #update_attribute" do
should "not ignore protected attribute on #update_attribute" do
@edoc.update_attribute('admin', true)
@edoc.admin.should be_false
@edoc.admin.should be_true
end

should "ignore protected attribute on #update_attributes" do
Expand Down
13 changes: 4 additions & 9 deletions test/functional/test_querying.rb
Expand Up @@ -693,16 +693,11 @@ def setup
end

should "update the attribute without invoking validations" do
setup do
@document = Doc do
key :name, String, :required => true
end
end
@document.key :name, String, :required => true

doc = @document.new
doc.expects(:valid?).never
doc.update_attribute('name', '').should be_true
doc.reload.name.should == ''
@doc.expects(:valid?).never
@doc.update_attribute('name', '').should be_true
@doc.reload.name.should == ''
@document.count.should == 1
end
end
Expand Down

0 comments on commit 21ce488

Please sign in to comment.