lib/pacto.rb in pacto-0.2.0 vs lib/pacto.rb in pacto-0.2.1

- old
+ new

@@ -13,18 +13,15 @@ require "pacto/request" require "pacto/response_adapter" require "pacto/response" require "pacto/instantiated_contract" require "pacto/contract" +require "pacto/contract_factory" require "pacto/file_pre_processor" module Pacto def self.build_from_file(contract_path, host, file_pre_processor=FilePreProcessor.new) - contract_definition_expanded = file_pre_processor.process(File.read(contract_path)) - definition = JSON.parse(contract_definition_expanded) - request = Request.new(host, definition["request"]) - response = Response.new(definition["response"]) - Contract.new(request, response) + ContractFactory.build_from_file(contract_path, host, file_pre_processor) end def self.register(name, contract) raise ArgumentError, "contract \" #{name}\" has already been registered" if registered.has_key?(name) registered[name] = contract