This allows you do something like:
User = Struct.new(:address)
Address = Struct.new(:street, :suburb)
class UserForm < Reform::Form
property :address do
property :street
This allows you do something like:
User = Struct.new(:address)
Address = Struct.new(:street, :suburb)
class UserForm < Reform::Form
property :address do
property :street
# pact-provider-proxy/vendor/rack-reverse-proxy/lib/rack/reverse_proxy.rb | |
require 'net/http' | |
require 'net/https' | |
require "rack-proxy" | |
require "rack/reverse_proxy_matcher" | |
require "rack/exception" | |
module Rack | |
class ReverseProxy |
# Note: this does not migrate the tags | |
require 'faraday' | |
require 'json' | |
source_host = 'http://some-pact-broker' | |
destination_host = 'http://localhost:9292' | |
latest_pacts_response = JSON.parse(Faraday.get("#{source_host}/pacts/latest").body) | |
pact_hrefs = latest_pacts_response['pacts'].collect{ | pact | pact['_links']['self'][1]['href'] } |
When you declare a request and response using the traditional Pact DSL, ("uponReceiving" and "willRespondWith") you're building a structure that has three purposes -
The three different uses of this structure are hidden from you when using HTTP Pact because the mock service handles numbers 1 & 2 in the consumer tests, and the verification task handles number 3 for you in the provider tests. When using Pact in a non-HTTP scenario, there is no nice neat protocol layer to inject the code to do this for you, so you have to explicitly do each step.
The file expected_data_from_collector.rb
declares an object graph using the Pact DSL. This is going to be used to create the concrete example and the contract. This could be declared inline, but for easier maintenance, and to allow the contr
source 'https://rubygems.org' | |
gem 'pact', '~>1.7.0' |
require 'pact/provider/proxy/tasks' | |
Pact::ProxyVerificationTask.new :userapi_service do | task | | |
task.pact_url './spec/pacts/userapi_service_consumer-userapi_service_provider.json' | |
task.provider_base_url 'https://userapi.com/' | |
end | |
Pact::ProxyVerificationTask.new :otherapi_service do | task | | |
task.pact_url './spec/pacts/otherapi_service_consumer-otherapi_service_provider.json' | |
task.provider_base_url 'https://otherapi.com' |
# gem "omniauth-github" | |
# gem "rack-rewrite" | |
require 'fileutils' | |
require 'logger' | |
require 'sequel' | |
require 'pact_broker' | |
require 'omniauth/strategies/github' | |
require 'rack/rewrite' |
Our tests should:
Identify the steps in the high level process
eg.
Create modules for each of those steps. In our use case, the top level process matches a pattern called "ETL" or "Extract, Transform, Load", so we used those names.