Kellie Persson
09/23/2022, 6:13 PMcircumstance-1.0.0
gem to setup state for me.
Do I need to do any special setup to gain access to these gems inside the provider state files? Thank you for you helpful. Excited to get this POC going.Beth (pactflow.io/Pact Broker/pact-ruby)
require "…"
?Kellie Persson
09/27/2022, 2:15 AMPact.configure do | config |
config.include ::Circumstance::Helpers
end
in my pact_helper.rb
file.Beth (pactflow.io/Pact Broker/pact-ruby)
Kellie Persson
09/27/2022, 4:29 PMlet
statements are not allowed in the provider state set_up
do block
E.g.
provider_state "default" do
set_up do
load_circumstance :data
end
end
under the hood, in the data
circumstance loads another circumstance,
Circumstance.define(:data) do
load_circumstance :base
end
in this circumstance 😅 , the following let statement is used:
Circumstance.define(:base) do
let(:level) { Level.find(1) }
end
it is this ⬆️ let
statement that seems to be causing the following error when trying to validate.
Failure/Error: let(:level) { Level.find(1) }
NoMethodError:
undefined method `let' for #<Pact::Provider::State::ProviderState:0x00007f854b79c7c8>
I am a ruby novice, but I believe let can only be defined in ruby describe
blocks. Is there any way around this error that I am seeing. I am trying to minimize the setup code by using previously defined circumstances that are used in our other RSpec tests.
Thank you for any help or direction you can provide. Let me know if you need additional information.Beth (pactflow.io/Pact Broker/pact-ruby)
let
is an rspec feature. You can only use plain ruby inside the provider state blocks.level = Level.find(1)
Kellie Persson
09/28/2022, 1:20 AM