Sha256: eb6ef128b9559b00577c0bcb1567db71652588aa707aa8701e0d6b5512cd2560

Contents?: true

Size: 585 Bytes

Versions: 15

Compression:

Stored size: 585 Bytes

Contents

require 'rack'

RSpec::Matchers.define :have_status do |status_code|
  match do |response|
    response.code == Restspec::Values::StatusCode.new(status_code).value
  end

  failure_message do |response|
    status_code = Restspec::Values::StatusCode.new(expected).value
    "expected #{response} to have status code: #{status_code} but it was #{response.code}"
  end

  failure_message_when_negated do |actual|
    status_code = Restspec::Values::StatusCode.new(expected).value
    "expected #{response} to don't have status code: #{status_code} but it was #{response.code}"
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/rspec/matchers/have_status.rb
restspec-0.3.1 lib/restspec/rspec/matchers/have_status.rb
restspec-0.3.0 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.6 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.5 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.4 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.3 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.2 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2.1 lib/restspec/rspec/matchers/have_status.rb
restspec-0.2 lib/restspec/rspec/matchers/have_status.rb
restspec-0.1 lib/restspec/rspec/matchers/have_status.rb
restspec-0.0.4 lib/restspec/rspec/matchers/have_status.rb
restspec-0.0.3 lib/restspec/rspec/matchers/have_status.rb
restspec-0.0.2 lib/restspec/rspec/matchers/have_status.rb
restspec-0.0.1 lib/restspec/rspec/matchers/have_status.rb