add spec to ensure that decorators work with delegation
This commit is contained in:
parent
bc1bae91b1
commit
39a984f068
|
@ -357,6 +357,10 @@ describe Draper::Decorator do
|
|||
Array(subject).should be_a Array
|
||||
end
|
||||
|
||||
it "proxies delegated methods" do
|
||||
subject.delegated_method.should == "Yay, delegation"
|
||||
end
|
||||
|
||||
context "with method security" do
|
||||
it "respects allows" do
|
||||
source.stub(:hello_world, :goodnight_moon).and_return(:proxied)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class Product < ActiveRecord::Base
|
||||
include Draper::Decoratable
|
||||
|
||||
delegate :delegated_method, to: :thing
|
||||
|
||||
def self.find_by_name(name)
|
||||
@@dummy ||= Product.new
|
||||
end
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
class SomeThing < Product
|
||||
def delegated_method
|
||||
'Yay, delegation'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue