Created
November 12, 2010 18:13
-
-
Save jeffdeville/674456 to your computer and use it in GitHub Desktop.
Showing a problem with overridding class methods in mocha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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