Closed AnkeshThakur closed 3 months ago
I'm seeing the same issue with instance_double
intermittently with v7
e.g/
Failure/Error: meh = instance_double(MyClass, this_does_exist: 42)
the MyClass class does not implement the instance method: this_does_exist
Just in case it's not obvious, the instance method does exist :)
Could you prepare an integration test like this one to help us reproduce an issue?
Or it could be a new Rails app that we could use to debug it?
Thank you.
Hi @ArturT do you mean something like https://github.com/KnapsackPro/knapsack_pro-ruby/pull/247/files ?
@GeoffTidey Yes.
I've run this test and it's passing successful.
➜ knapsack_pro-ruby git:(pr/247) rspec spec/integration/runners/queue/rspec_runner_spec.rb:382
Resolving dependencies...
Run options: include {:locations=>{"./spec/integration/runners/queue/rspec_runner_spec.rb"=>[382]}}
Randomized with seed 65516
KnapsackPro::Runners::Queue::RSpecRunner - Integration tests
when rails_helper file exists
requires the rails_helper file when running RSpec and runs hooks defined within it
Finished in 0.2351 seconds (files took 0.42629 seconds to load)
1 example, 0 failures
Randomized with seed 65516
We need to prepare a test that would fail with the same error as you see in your project. Then we could prepare a fix for that.
Are you able to identify what is causing the error in your project?
Afraid not. It's intermittent.
I use the following loop to run test as long until it fails but it is successful. I'm not able to reproduce the issue.
while bundle exec rspec "spec/integration/runners/queue/rspec_runner_spec.rb:382"; do :; done
I use ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [arm64-darwin22].
I tried to reproduce it on an older RSpec version without success:
# source Gemfile.lock in the knasack_pro gem
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
I also tried to use the latest gems, but I'm not able to reproduce the issue:
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
@GeoffTidey Could you provide your Ruby and dependency versions? It will help pinpoint what differs between our setups.
Hi @ArturT , sorry for the radio silence. It's not been happening at all since my last update. Two things have changed, the first is probably the issue:
KnapsackPro::Adapters::RSpecAdapter.bind
to spec/spec_helper.rb (it was perviously in another helper that is only loaded for system tests), @GeoffTidey Thank you for providing solution to your issue.
@AnkeshThakur Could you ensure KnapsackPro::Adapters::RSpecAdapter.bind
is in spec/spec_helper.rb
?
You could also update the knapsack_pro gem to the latest version. We released a couple of improvements.
I'd appreciate an update from you. If it's no longer a relevant issue, please let me know.
@ArturT apology for silence. I'm no longer integrating KnapsackPro. For me older version (<7.0.0) worked without issue.
I have not updated it to later version to check if 7+ versions are working or not.
I am setting up Knapsack Pro with gem version 7.0.0 and 7.0.1. Tests are failing with both the versions which otherwise is passing.
I am mostly getting two types of error which relates to
instance_double
tests and materialize-view dependent tests. Following is the error description from the runsOther error:
I am trying to set it up on Github Actions with VCR/WebMosck setup. All of these tests are passing when I try it with 6.0.4.
Following is the command that I'm using to invoke the test in GHA runner
bundle exec rake "knapsack_pro:queue:rspec[--require packs/rails/rspec --require spec_helper --order rand --require fivemat --format Fivemat --format RSpec::Github::Formatter --format RspecJunitFormatter --out report/ruby-rspec-${{ matrix.node_index }}.xml]"