delegate respond_to? to decorated model with second param

This commit is contained in:
Vasiliy Ermolovich 2012-04-10 23:09:29 +03:00
parent da4666e860
commit 3504393678
2 changed files with 9 additions and 1 deletions

View File

@ -211,7 +211,7 @@ module Draper
alias :is_a? :kind_of?
def respond_to?(method, include_private = false)
super || (allow?(method) && model.respond_to?(method))
super || (allow?(method) && model.respond_to?(method, include_private))
end
def method_missing(method, *args, &block)

View File

@ -414,6 +414,14 @@ describe Draper::Base do
end
end
context ".respond_to?" do
it "should delegate respond_to? to the decorated model" do
other = Draper::Base.new(source)
source.should_receive(:respond_to?).with(:whatever, true)
subject.respond_to?(:whatever, true)
end
end
context 'position accessors' do
[:first, :last].each do |method|
context "##{method}" do