Sha256: 36baadad8270b3ab90243974b3223ae68efd708d62b2479d47ddad4c9ae5da2a
Contents?: true
Size: 1.72 KB
Versions: 12
Compression:
Stored size: 1.72 KB
Contents
require 'pact/provider/rspec' require 'flapjack/configuration' require 'flapjack/gateways/jsonapi' require './spec/service_consumers/provider_states_for_flapjack-diner.rb' $testing = true 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
12 entries across 12 versions & 1 rubygems