Sha256: ff3d72e9c8bc8d0f1bdf22965deb28f2e5ee5d842d51981af0b7f7eaa5c19a4f

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

require 'json'

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.configure do | config |
			config.producer do
				name "Some Producer"
				app { TestApp.new }
			end
		end


		#one with a top level consumer
		Pact.with_consumer 'some-test-consumer' do
			producer_state "the weather is sunny" do
				set_up do
					WEATHER ||= {}
					WEATHER[:current_state] = 'sunny'
				end
			end
		end

		#one without a top level consumer
		Pact.producer_state "the weather is cloudy" do
			set_up do
				WEATHER ||= {}
				WEATHER[:current_state] = 'cloudy'
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact-0.1.28 spec/support/pact_rake_support.rb