NameError: uninitialized constant Dry::Validation::Contract::ClassInterface when using binding.pry inside spec examples

Hello,
in the project I use dry-validation gem.

When I use binding.pry inside rspec examples and call the subject:

subject(:update_store) { described_class.new(partner.user, params).call }

....

it "creates 2 opening hours" do
  binding.pry
  expect { update_store }.to change { OpeningHour.count }.from(0).to(2)
end

I get this error:

[1] pry(#<RSpec::ExampleGroups::StoresUseCasesUpdate::WhenEverythingIsFineAndWell::WhenOpeningHoursAreUpdated::WhenOpeningHoursAreNotYetCreated>)> update_store
NameError: uninitialized constant Dry::Validation::Contract::ClassInterface
from /usr/local/bundle/gems/dry-validation-1.10.0/lib/dry/validation/contract.rb:47:in `<class:Contract>'

I’m pretty sure it used to work. Has anyone had a similar problem?

Have you recently updated the gem from < 1.9.0? If you look at the Changelog note that it recently switched to using zeitwerk for loading.

This means that if you are doing e.g. require "dry/validation/contract" you should remove that and only do require "dry/validation", as that will set up the zeitwerk gem loader for all other constants.

Have the same issue: running a test and using binding.pry in a controller. Everything fine if i let the test run its course or run rails console.

I have tried to require some parts in rails_helper.rb and it solves ClassInterface, but there are other modules that fail down the line
For example, third in line is NameError: uninitialized constant Dry::Schema::Messages::Abstract - it fails in case requiring message_compiler

require 'dry/validation/contract'
require 'dry/schema/message_compiler'