Sha256: b3af10c28945f2a6427539ec381221173933f00bd19db99cbaf5d94dcd8d4f0d

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# -*- encoding : utf-8 -*-
module Pacto
  module Formats
    module Legacy
      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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pacto-0.4.0.rc3 spec/unit/pacto/formats/legacy/response_clause_spec.rb
pacto-0.4.0.rc2 spec/unit/pacto/formats/legacy/response_clause_spec.rb