mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
fix capture proxying
This commit is contained in:
parent
83794af7ea
commit
f8d4d6960b
2 changed files with 13 additions and 0 deletions
|
@ -16,6 +16,8 @@ module Draper
|
||||||
send(method, *args, &block)
|
send(method, *args, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
delegate :capture, to: :view_context
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_reader :view_context
|
attr_reader :view_context
|
||||||
|
|
|
@ -38,5 +38,16 @@ module Draper
|
||||||
expect(HelperProxy.instance_methods).to include :foo
|
expect(HelperProxy.instance_methods).to include :foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "proxying methods which are overriding" do
|
||||||
|
it "proxies :capture" do
|
||||||
|
view_context = double
|
||||||
|
helper_proxy = HelperProxy.new(view_context)
|
||||||
|
|
||||||
|
view_context.stub(:capture).and_return{|*args, &block| [*args, block.call] }
|
||||||
|
expect(helper_proxy.capture(:first_arg, :second_arg){:yielded}).to \
|
||||||
|
be_eql [:first_arg, :second_arg, :yielded]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue