Sha256: d2c8d3aac2b8d351562a7b4998f04377a802337e70149a0963e954e62a3fe886

Contents?: true

Size: 426 Bytes

Versions: 4

Compression:

Stored size: 426 Bytes

Contents

RSpec::Matchers.define :be_like_schema_array do |schema_name = nil|
  match do |response|
    schema = if schema_name.present?
      Restspec::SchemaStore.get(schema_name)
    else
      response.endpoint.schema
    end

    body = response.respond_to?(:body) ? response.body : response
    checker_for(schema).check_array!(body)
  end

  private

  def checker_for(schema)
    Restspec::Schema::Checker.new(schema)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restspec-0.0.4 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.0.3 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.0.2 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.0.1 lib/restspec/rspec/matchers/be_like_schema_array.rb