Class: Pact::MockService::Session
- Inherits:
-
Object
- Object
- Pact::MockService::Session
- Defined in:
- lib/pact/mock_service/session.rb
Instance Attribute Summary collapse
-
#actual_interactions ⇒ Object
readonly
Returns the value of attribute actual_interactions.
-
#consumer_contract_details ⇒ Object
readonly
Returns the value of attribute consumer_contract_details.
-
#expected_interactions ⇒ Object
readonly
Returns the value of attribute expected_interactions.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#verified_interactions ⇒ Object
readonly
Returns the value of attribute verified_interactions.
Instance Method Summary collapse
- #add_expected_interaction(interaction) ⇒ Object
- #clear_all ⇒ Object
- #clear_expected_and_actual_interactions ⇒ Object
-
#initialize(options) ⇒ Session
constructor
A new instance of Session.
- #set_expected_interactions(interactions) ⇒ Object
Constructor Details
#initialize(options) ⇒ Session
Returns a new instance of Session.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pact/mock_service/session.rb', line 16 def initialize @logger = [:logger] @expected_interactions = Interactions::ExpectedInteractions.new @actual_interactions = Interactions::ActualInteractions.new @verified_interactions = Interactions::VerifiedInteractions.new @consumer_contract_details = { pact_dir: [:pact_dir], consumer: {name: [:consumer]}, provider: {name: [:provider]}, interactions: verified_interactions, pact_specification_version: [:pact_specification_version] } end |
Instance Attribute Details
#actual_interactions ⇒ Object (readonly)
Returns the value of attribute actual_interactions.
14 15 16 |
# File 'lib/pact/mock_service/session.rb', line 14 def actual_interactions @actual_interactions end |
#consumer_contract_details ⇒ Object (readonly)
Returns the value of attribute consumer_contract_details.
14 15 16 |
# File 'lib/pact/mock_service/session.rb', line 14 def consumer_contract_details @consumer_contract_details end |
#expected_interactions ⇒ Object (readonly)
Returns the value of attribute expected_interactions.
14 15 16 |
# File 'lib/pact/mock_service/session.rb', line 14 def expected_interactions @expected_interactions end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
14 15 16 |
# File 'lib/pact/mock_service/session.rb', line 14 def logger @logger end |
#verified_interactions ⇒ Object (readonly)
Returns the value of attribute verified_interactions.
14 15 16 |
# File 'lib/pact/mock_service/session.rb', line 14 def verified_interactions @verified_interactions end |
Instance Method Details
#add_expected_interaction(interaction) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/pact/mock_service/session.rb', line 48 def add_expected_interaction interaction if (previous_interaction = interaction_already_verified_with_same_description_and_provider_state_but_not_equal(interaction)) handle_almost_duplicate_interaction previous_interaction, interaction else really_add_expected_interaction interaction end end |
#clear_all ⇒ Object
42 43 44 45 46 |
# File 'lib/pact/mock_service/session.rb', line 42 def clear_all expected_interactions.clear actual_interactions.clear verified_interactions.clear end |
#clear_expected_and_actual_interactions ⇒ Object
37 38 39 40 |
# File 'lib/pact/mock_service/session.rb', line 37 def clear_expected_and_actual_interactions expected_interactions.clear actual_interactions.clear end |
#set_expected_interactions(interactions) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/pact/mock_service/session.rb', line 30 def set_expected_interactions interactions clear_expected_and_actual_interactions interactions.each do | interaction | add_expected_interaction interaction end end |