Sha256: 7a33f73d63b4f9e88666445b1515d72b9b5e76b591d20924bd21ff6a7f1ff319
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
require 'pact/provider/rspec' require 'flapjack/configuration' require 'flapjack/gateways/jsonapi' require './spec/service_consumers/provider_states_for_flapjack-diner.rb' FLAPJACK_ENV = ENV["FLAPJACK_ENV"] || 'test' FLAPJACK_ROOT = File.join(File.dirname(__FILE__), '..') FLAPJACK_CONFIG = File.join(FLAPJACK_ROOT, 'etc', 'flapjack_config.yaml') ENV['RACK_ENV'] = ENV["FLAPJACK_ENV"] require 'bundler' Bundler.require(:default, :test) class MockLogger attr_accessor :messages def initialize @messages = [] end %w(debug info warn error fatal).each do |level| class_eval <<-RUBY def #{level}? true end def #{level}(msg) @messages << msg end RUBY end end Flapjack::Gateways::JSONAPI.instance_variable_get('@middleware').delete_if {|m| m[0] == Rack::FiberPool } Flapjack::Gateways::JSONAPI.class_eval do set :show_exceptions, false set :raise_errors, false error do Flapjack::Gateways::JSONAPI.instance_variable_get('@rescue_exception'). call(env, env['sinatra.error']) end end cfg = Flapjack::Configuration.new $redis_options = cfg.load(FLAPJACK_CONFIG) ? cfg.for_redis : {:db => 14, :driver => :ruby} Flapjack::Gateways::JSONAPI.instance_variable_set('@config', 'port' => 19081) Flapjack::Gateways::JSONAPI.instance_variable_set('@redis_config', $redis_options) Flapjack::Gateways::JSONAPI.instance_variable_set('@logger', MockLogger.new) Flapjack::Gateways::JSONAPI.start Pact.configure do |config| end Pact.service_provider "flapjack" do app { Flapjack::Gateways::JSONAPI.new } honours_pact_with 'flapjack-diner' do pact_uri './spec/service_consumers/pacts/flapjack-diner_v1.0.json' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flapjack-1.4.0 | spec/service_consumers/pact_helper.rb |
flapjack-1.4.0rc1 | spec/service_consumers/pact_helper.rb |