Skip to content

Conflict with raise_error from RSpec #136

Description

@joergschiller

We have a system spec that looks like this:

it "raises a not found error" do
  expect { visit reportings_account_dashboard_path(project) }.to raise_error(ActiveRecord::RecordNotFound)
end

After upgrading capybara-screenshot-diff this fails with:

ArgumentError:
 wrong number of arguments (given 1, expected 2)
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/capybara-screenshot-diff-1.9.2/lib/capybara/screenshot/diff/test_methods.rb:171:in `raise_error'
# ./spec/features/admin/mailers_spec.rb:63:in `block (3 levels) in <top (required)>'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:263:in `instance_exec'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:263:in `block in run'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:486:in `block in run'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:352:in `call'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-rails-7.1.0/lib/rspec/rails/example/system_example_group.rb:174:in `block (2 levels) in <module:SystemExampleGroup>'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:390:in `execute_with'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:352:in `call'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-rails-7.1.0/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:390:in `execute_with'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
# /Users/joerg/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:352:in `call'
# ./spec/rails_helper.rb:219:in `block (2 levels) in <top (required)>'

It looks like your Capybara::Screenshot::Diff::TestMethods#raise_error conflicts with RSpec::Matchers#raise_error.

Let me know if I can provide you with more details.

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions