Sha256: be38a6587bffa6e8f64246b1445c58bacdfc4f676a09d3a47645337fe38fa550
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
RSpec::Matchers.define :be_successful do match do |response| response.success? end failure_message_for_should do |response| errors = response.errors.map(&:message).join(", ") "#{response} should be successful, got error(s): #{errors}" end failure_message_for_should_not do |response| "#{response} should not be successful" end end RSpec::Matchers.define :fail do chain :with_message do |message| @message = message end match do |response| @failure = !response.success? if(@message) @failure && response.errors.map(&:message).include?(@message) else @failure end end failure_message_for_should do |response| errors = response.errors.map(&:message).join(", ") if(@message) "#{response} should have error message: #{@message}" else "#{response} should not be successful" end end failure_message_for_should_not do |response| "#{response} should be successful" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
netaxept-0.2.0 | spec/support/matchers/response_success_matcher.rb |