Sha256: cce9597bcd1cfc1e8f7f4a6c2d0ded8f964d16e8b8a9bc7e8aee85e06ca5c1e5
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
# -*- encoding : utf-8 -*- require 'pacto/formats/legacy/request_clause' require 'pacto/formats/legacy/response_clause' module Pacto module Formats module Legacy class Contract < Pacto::Dash include Pacto::Contract property :id property :file property :request, required: true # Although I'd like response to be required, it complicates # the partial contracts used the rake generation task... # yet another reason I'd like to deprecate that feature property :response # , required: true property :values, default: {} # Gotta figure out how to use test doubles w/ coercion coerce_key :request, RequestClause coerce_key :response, ResponseClause property :examples property :name, required: true property :adapter, default: proc { Pacto.configuration.adapter } property :consumer, default: proc { Pacto.configuration.default_consumer } property :provider, default: proc { Pacto.configuration.default_provider } def initialize(opts) skip_freeze = opts.delete(:skip_freeze) if opts[:file] opts[:file] = Addressable::URI.convert_path(File.expand_path(opts[:file])).to_s opts[:name] ||= opts[:file] end opts[:id] ||= (opts[:summary] || opts[:file]) super freeze unless skip_freeze end def freeze (keys.map(&:to_sym) - [:values, :adapter, :consumer, :provider]).each do | key | send(key).freeze end self end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.4.0.rc3 | lib/pacto/formats/legacy/contract.rb |
pacto-0.4.0.rc2 | lib/pacto/formats/legacy/contract.rb |