Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Spec::Matchers.create(:be_successful) do
- matches do |rack|
- rack.status == 200
- end
- message do |not_string, rack|
- "Expected #{describe_request(rack)}#{not_string} " \
- "to be successful, but it returned a #{rack.status}"
- end
- end
- def be_successful
- simple_matcher("response to be successful") do |response|
- response.status == 200
- end
- end
- or
- def be_successful
- simple_matcher("response to be successful") do |response, matcher|
- matcher.failure_message = "expected successful response, got #{response.status}"
- matcher.negative_failure_message = "expected error response, got #{response.status}"
- response.status == 200
- end
- end
Add Comment
Please, Sign In to add comment