Sha256: 8f363241b8e924095abc359bdb3df44275f17ea1e6cb3dbf428bb6105cb5f179
Contents?: true
Size: 932 Bytes
Versions: 4
Compression:
Stored size: 932 Bytes
Contents
require 'json' require 'pact/provider/rspec' # pact_helper for rake pact:tests module Pact module Test class TestApp def call env if env['PATH_INFO'] == '/weather' [200, {'Content-Type' => 'application/json'}, [{message: WEATHER[:current_state]}.to_json]] else raise "unexpected path #{env['PATH_INFO']}!!!" end end end Pact.service_provider "Some Provider" do app { TestApp.new } honours_pact_with 'some-test-consumer' do pact_uri './spec/support/test_app_pass.json' end end #one with a top level consumer Pact.provider_states_for 'some-test-consumer' do provider_state "the weather is sunny" do set_up do WEATHER ||= {} WEATHER[:current_state] = 'sunny' end end end #one without a top level consumer Pact.provider_state "the weather is cloudy" do set_up do WEATHER ||= {} WEATHER[:current_state] = 'cloudy' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pact-1.0.9 | spec/support/pact_helper.rb |
pact-1.0.8 | spec/support/pact_helper.rb |
pact-1.0.7 | spec/support/pact_helper.rb |
pact-1.0.6 | spec/support/pact_helper.rb |