나는 내가 이것을 실행할 때 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)
이유는 무엇입니까? 내 모델에 똑같은 코드가 있고 요청 사양이 잘 실행되지만 도우미 사양에서는 그렇지 않습니다.