Skip to content

Commit

Permalink
Don't respond_to the source's private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
haines committed Dec 2, 2012
1 parent 8ef5bf2 commit 18ebac8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/draper/decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@
subject.respond_to?(:awesome_private_title, true).should be_true
end

it "returns true for the source's private methods" do
subject.respond_to?(:private_title, true).should be_true
it "returns false for the source's private methods" do
subject.respond_to?(:private_title, true).should be_false
end
end

Expand Down Expand Up @@ -361,6 +361,10 @@
subject.delegated_method.should == "Yay, delegation"
end

it "does not proxy private methods" do
expect{subject.private_title}.to raise_error NoMethodError
end

context "with method security" do
it "respects allows" do
source.stub(:hello_world, :goodnight_moon).and_return(:proxied)
Expand Down

0 comments on commit 18ebac8

Please sign in to comment.