commit
cb3878a867
|
@ -185,7 +185,7 @@ module Draper
|
||||||
#
|
#
|
||||||
# @return [Object] proxy
|
# @return [Object] proxy
|
||||||
def helpers
|
def helpers
|
||||||
HelpersWrapper.new self.class.helpers
|
@helpers ||= HelpersWrapper.new self.class.helpers
|
||||||
end
|
end
|
||||||
alias :h :helpers
|
alias :h :helpers
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,13 @@ describe Draper::Decorator do
|
||||||
it "is aliased to .h" do
|
it "is aliased to .h" do
|
||||||
subject.h.should == subject.helpers
|
subject.h.should == subject.helpers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "initializes the wrapper only once" do
|
||||||
|
helper_proxy = subject.helpers
|
||||||
|
helper_proxy.stub(:test_method) { "test_method" }
|
||||||
|
subject.helpers.test_method.should eq("test_method")
|
||||||
|
subject.helpers.test_method.should eq("test_method")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context("#helpers") do
|
context("#helpers") do
|
||||||
|
|
Loading…
Reference in New Issue