Sha256: 33ea697872c05af4723e81f2faffb607d24f8cc8340d2b4a1bb265525a279b57

Contents?: true

Size: 429 Bytes

Versions: 11

Compression:

Stored size: 429 Bytes

Contents

RSpec::Matchers.define :be_like_schema 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!(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.rb
restspec-0.3.1 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.3.0 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.6 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.5 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.4 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.3 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.2 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2.1 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.2 lib/restspec/rspec/matchers/be_like_schema.rb
restspec-0.1 lib/restspec/rspec/matchers/be_like_schema.rb