Module: SbmtPactConsumerDsl::ClassMethods

Defined in:
lib/sbmt/pact/rspec/support/pact_consumer_helpers.rb

Instance Method Summary collapse

Instance Method Details

#_has_pact_between(transport_type, consumer, provider, opts: {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sbmt/pact/rspec/support/pact_consumer_helpers.rb', line 21

def _has_pact_between(transport_type, consumer, provider, opts: {})
  raise "has_#{transport_type}_pact_between is designed to be used with RSpec 3+" unless defined?(::RSpec)
  raise "has_#{transport_type}_pact_between has to be declared at the top level of a suite" unless top_level?
  raise "has_*_pact_between cannot be declared more than once per suite" if defined?(@_pact_config)

  # rubocop:disable RSpec/BeforeAfterAll
  before(:context) do
    @_pact_config = Sbmt::Pact::Consumer::PactConfig.new(transport_type, consumer_name: consumer, provider_name: provider, opts: opts)
  end
  # rubocop:enable RSpec/BeforeAfterAll
end

#has_grpc_pact_between(consumer, provider, opts: {}) ⇒ Object



13
14
15
# File 'lib/sbmt/pact/rspec/support/pact_consumer_helpers.rb', line 13

def has_grpc_pact_between(consumer, provider, opts: {})
  _has_pact_between(:grpc, consumer, provider, opts: opts)
end

#has_http_pact_between(consumer, provider, opts: {}) ⇒ Object



9
10
11
# File 'lib/sbmt/pact/rspec/support/pact_consumer_helpers.rb', line 9

def has_http_pact_between(consumer, provider, opts: {})
  _has_pact_between(:http, consumer, provider, opts: opts)
end

#has_message_pact_between(consumer, provider, opts: {}) ⇒ Object



17
18
19
# File 'lib/sbmt/pact/rspec/support/pact_consumer_helpers.rb', line 17

def has_message_pact_between(consumer, provider, opts: {})
  _has_pact_between(:message, consumer, provider, opts: opts)
end