Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mocking in RSpec.
context "on ClaimRoute failure" do
let(:service_double) { instance_double(ClaimRoute, call: service_result, errors: service_expected_errors) }
let(:service_result) { false }
let(:service_expected_errors) { [ClaimRoute::REQUIRED_PARAMETERS_NOT_PROVIDED] }
before do
post_claim_route
end
it "redirects to the game page" do
expect(response).to redirect_to game
end
it "has the expected errors in the flash with error prefix" do
expect(flash[:errors]).to eq service_expected_errors_prefixed
end
end
@jordancrawfordnz

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.