Skip to content

Instantly share code, notes, and snippets.

@jeffdeville
Created November 12, 2010 18:13
Show Gist options
  • Save jeffdeville/674456 to your computer and use it in GitHub Desktop.
Save jeffdeville/674456 to your computer and use it in GitHub Desktop.
Showing a problem with overridding class methods in mocha
before do
mock_load_request
mock_audit_gift_create
mock_save_request
end
it "should load the request" do
mock_load_request("expects")
act
end
it "should audit the gift creation" do
mock_audit_gift_create("expects")
act
end
it "should save the request" do
mock_save_request("expects")
act
end
def mock_load_request(stubs_or_expects="stubs")
reco_mock = mock('mock_reco_crit')
reco_mock.send(stubs_or_expects, :id).with(@reco_request._id.to_s).returns([@reco_request])
RecommendationRequest.send(stubs_or_expects, :criteria).returns(reco_mock)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment