Sha256: f561c86f162d9f65e305c41f1e8cd73025690e4d15204327877e17e920a5ca9c

Contents?: true

Size: 441 Bytes

Versions: 11

Compression:

Stored size: 441 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_for(:response)
    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

11 entries across 11 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.3.1 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.3.0 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.6 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.5 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.4 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.3 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.2 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2.1 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.2 lib/restspec/rspec/matchers/be_like_schema_array.rb
restspec-0.1 lib/restspec/rspec/matchers/be_like_schema_array.rb