Sha256: c6772eeb93f4774c0f3f938c8728cf6d8c82095efa1a0d553e9ae9de749a0cf9

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

# -*- encoding : utf-8 -*-
module Pacto
  describe ResponseClause do
    let(:body_definition) do
      Fabricate(:schema)
    end

    let(:definition) do
      {
        'status' => 200,
        'headers' => {
          'Content-Type' => 'application/json'
        },
        'schema' => body_definition
      }
    end

    subject(:response) { described_class.new(definition) }

    it 'has a status' do
      expect(response.status).to eq(200)
    end

    it 'has a headers hash' do
      expect(response.headers).to eq(
        'Content-Type' => 'application/json'
      )
    end

    it 'has a schema' do
      expect(response.schema).to eq(body_definition)
    end

    it 'has a default value for the schema' do
      definition.delete 'schema'
      response = described_class.new(definition)
      expect(response.schema).to eq(Hash.new)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacto-0.4.0.rc1 spec/unit/pacto/response_clause_spec.rb