class Pact::Provider::RSpec::InteractionContext
The “arrange” and “act” parts of the test really only need to be run once, however, stubbing is not supported in before :all, so this is a wee hack to enable before :all like functionality using before :each. In an ideal world, the test setup and execution should be quick enough for the difference between :all and :each to be unnoticable, but the annoying reality is, sometimes it does make a difference. This is for you, V!
Attributes
last_response[RW]
Public Class Methods
new()
click to toggle source
# File lib/pact/provider/rspec.rb, line 217 def initialize @already_run = [] end
Public Instance Methods
run_once(hook) { || ... }
click to toggle source
# File lib/pact/provider/rspec.rb, line 221 def run_once hook unless @already_run.include?(hook) yield @already_run << hook end end