delegate respond_to? to decorated model with second param
This commit is contained in:
parent
da4666e860
commit
3504393678
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue