Sha256: 9056202a3203f76e975581c3ff47d331b8fcf289c572acbfe1db8575ec502add

Contents?: true

Size: 438 Bytes

Versions: 7

Compression:

Stored size: 438 Bytes

Contents

module RequestSupport
  def response_body
    JSON.parse last_response.body
  end

  def match_response_schema(schema, options={})
    default_optitons = { strict: true, validate_schema: true }
    schema_directory = "#{ Dir.pwd }/spec/schemas"
    schema_path = "#{ schema_directory }/#{ schema }.json"

    JSON::Validator.clear_cache
    JSON::Validator.validate!(schema_path, response_body, default_optitons.merge(options))
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sinatra-active-model-serializers-0.3.0 spec/support/request_support.rb
sinatra-active-model-serializers-0.2.2 spec/support/request_support.rb
sinatra-active-model-serializers-0.2.1 spec/support/request_support.rb
sinatra-active-model-serializers-0.2.0 spec/support/request_support.rb
sinatra-active-model-serializers-0.1.0 spec/support/request_support.rb
sinatra-active-model-serializers-0.0.3 spec/support/request_support.rb
sinatra-active-model-serializers-0.0.2 spec/support/request_support.rb