Sha256: 0d5a7ee5f40d656744abe27f06a1ea5e901c7d3bee81ffa3eb5d57c450e97b91

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# -*- encoding : utf-8 -*-
require 'spec_helper'

module Pacto
  module Formats
    module Legacy
      describe ContractFactory do
        let(:host)                 { 'http://localhost' }
        let(:contract_format)      { 'legacy' }
        let(:contract_name)        { 'contract' }
        let(:contract_path)        { contract_file(contract_name, contract_format) }
        subject(:contract_factory) { described_class.new }

        it 'builds a Contract given a JSON file path and a host' do
          contract = contract_factory.build_from_file(contract_path, host)
          expect(contract).to be_a(Pacto::Formats::Legacy::Contract)
        end

        context 'deprecated contracts' do
          let(:contract_format)      { 'deprecated' }
          let(:contract_name)        { 'deprecated_contract' }
          it 'can no longer be loaded' do
            expect { contract_factory.build_from_file(contract_path, host) }.to raise_error(/old syntax no longer supported/)
          end
        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/contract_factory_spec.rb
pacto-0.4.0.rc2 spec/unit/pacto/formats/legacy/contract_factory_spec.rb