Sha256: 01daeebf0b89ae8ae493583175bbe29794c1fa55a7ff9ca7b6c14445ec4ae705

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

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

module Pacto
  describe NativeContractFactory do
    let(:host)                 { 'http://localhost' }
    let(:contract_name)        { 'contract' }
    let(:contracts_path)       { %w(spec fixtures contracts) }
    let(:contract_path)        { File.join(contracts_path, "#{contract_name}.json") }
    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(Contract)
    end

    context 'deprecated contracts' do
      let(:contracts_path)       { %w(spec fixtures deprecated_contracts) }
      let(:contract_name)        { 'deprecated_contract' }
      it 'can still be loaded' do
        contract = contract_factory.build_from_file(contract_path, host)
        expect(contract).to be_a(Contract)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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