Class: Shokkenki::Consumer::Model::Provider
- Extended by:
- Forwardable
- Defined in:
- lib/shokkenki/consumer/model/provider.rb
Instance Attribute Summary collapse
-
#stubber ⇒ Object
readonly
Returns the value of attribute stubber.
Attributes inherited from Role
Instance Method Summary collapse
- #assert_all_interactions_used! ⇒ Object
- #assert_all_requests_matched! ⇒ Object
-
#initialize(attributes) ⇒ Provider
constructor
A new instance of Provider.
Methods inherited from Role
Methods included from Simplification
Constructor Details
#initialize(attributes) ⇒ Provider
14 15 16 17 |
# File 'lib/shokkenki/consumer/model/provider.rb', line 14 def initialize attributes super attributes @stubber = attributes[:stubber] || Shokkenki::Consumer::Stubber::LocalServerStubber.new({}) end |
Instance Attribute Details
#stubber ⇒ Object (readonly)
Returns the value of attribute stubber.
12 13 14 |
# File 'lib/shokkenki/consumer/model/provider.rb', line 12 def stubber @stubber end |
Instance Method Details
#assert_all_interactions_used! ⇒ Object
25 26 27 28 29 |
# File 'lib/shokkenki/consumer/model/provider.rb', line 25 def assert_all_interactions_used! unused_interactions = @stubber.unused_interactions = "In provider '#{@name}' the following interactions were never used: #{JSON.pretty_generate(unused_interactions)}" raise unless unused_interactions.empty? end |
#assert_all_requests_matched! ⇒ Object
19 20 21 22 23 |
# File 'lib/shokkenki/consumer/model/provider.rb', line 19 def assert_all_requests_matched! unmatched_requests = @stubber.unmatched_requests = "In provider '#{@name}' the following requests were not matched: #{JSON.pretty_generate(unmatched_requests)}" raise unless unmatched_requests.empty? end |