0
我已經在我的application_helper_spec.rb
rspec的設()行爲
shared_examples_for "some shared process" do
it "displays the value defined by Let" do
puts object.inspect # This should output the value defined by Let
end
end
describe ApplicationHelper do
describe "a_helper_methond" do
describe "some behaviour" do
let(:object) { "foo" }
puts object.inspect # This should output the value defined by Let
it_should_behave_like "some shared process"
end
end
end
然而,當我運行此我得到兩個放兩個錯誤如下:
undefined local variable or method `object' for #<Class:0x007f951a3a7b20> (NameError)
爲什麼?我的模型中有完全相同的代碼,並且請求規範在運行良好,但在幫助程序規範中沒有。