Sha256: 468c38a6160f693ea407a5d844ef289f75a6dc8fd816f4ed8f803bae4cf23924

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

module Pacto
  describe ContractFactory do
    let(:host)               { 'http://localhost' }
    let(:contract_name)      { 'contract' }
    let(:contract_path)      { File.join('spec', 'unit', 'data', "#{contract_name}.json") }
    let(:file_pre_processor) { double('file_pre_processor') }
    let(:file_content)       { File.read(contract_path)}

    describe '.build_from_file' do
      it 'should build a contract given a JSON file path and a host' do
        file_pre_processor.stub(:process).and_return(file_content)
        described_class.build_from_file(contract_path, host, file_pre_processor).
          should be_a_kind_of(Pacto::Contract)
      end

      it 'should process files using File Pre Processor module' do
        file_pre_processor.should_receive(:process).with(file_content).and_return(file_content)
        described_class.build_from_file(contract_path, host, file_pre_processor)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacto-0.2.3 spec/unit/pacto/contract_factory_spec.rb
pacto-0.2.2 spec/unit/pacto/contract_factory_spec.rb
pacto-0.2.1 spec/unit/pacto/contract_factory_spec.rb