Sha256: 2cb5dd230bffb3d6fff227d5a27c2e878fb60cd9780e0bfaee38a500118be4da

Contents?: true

Size: 629 Bytes

Versions: 5

Compression:

Stored size: 629 Bytes

Contents

RSpec::Matchers.define :respond_with_collection_size do |expected|
  match do |actual|
    JSON::parse(actual.browser.last_response.body).size == expected
  end
  description do
    "respond with a collection of record size of #{expected}"
  end
  failure_message do |actual|
    "expected #{actual} response body collection would have a size of #{expected}, \ngot #{JSON::parse(actual.browser.last_response.body).size}"
  end
  failure_message_when_negated do |actual|
    "expected #{actual} response body collection would not have a size of #{expected}, \ngot #{JSON::parse(actual.browser.last_response.body).size}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-rest-rspec-0.0.4 lib/rack-rest-rspec/matchers/respond_with_collection_size.rb
rack-rest-rspec-0.0.3 lib/rack-rest-rspec/matchers/respond_with_collection_size.rb
rack-rest-rspec-0.0.2 lib/rack-rest-rspec/matchers/respond_with_collection_size.rb
rack-rest-rspec-0.0.1 lib/rack-rest-rspec/matchers/respond_with_collection_size.rb
rack-rest-rspec-0.0.1a lib/rack-rest-rspec/matchers/respond_with_collection_size.rb