Hi,
This piece of code does not work. Does anybody know the cause?
describe “/loan-events/{source-id}-lend.json” do
describe “GET” do
it “should call all method of LoanEvent with source_id” do
source_id = rand(1000)
LoanEvent.should_receive(:all).with(:source_id =>
source_id.to_s).once
get “/loan-events/#{source_id}-lend.json”
end
it “should return the JSON of this LoanEvent collection” do
collection = mock(“collection”)
LoadEvent.stub!(:all).and_return(collection)
collection.should_receive(:to_json).with(no_args).once
get “/loan-events/#{rand(1000)}-lend.json”
end
end
end
- EIOU::CoreApplication /loan-events/{source-id}-lend.json GET should
return the JSON of this LoanEvent collection
Failure/Error: LoadEvent.should_receive(:all).and_return({})
uninitialized constant
RSpec::Core::ExampleGroup::Nested_1::Nested_2::Nested_1::LoadEvent./spec/core_application_spec.rb:42:in `block (4 levels) in <top
(required)>’
Best regards,
Zhi-Qiang L.
[email protected]