rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

Change matcher is breaking with Ruby 3.2 #2992

Closed wrburgess closed 1 year ago

wrburgess commented 1 year ago

Subject of the issue

Your environment

Steps to reproduce

require "rails_helper"

describe SourceCountry, type: :feature do
  context "create" do
    let!(:source) { FactoryBot.create(:source) }

    # Matcher below has conflict with Ruby 3.2
    it "can be created by an admin" do
      user = FactoryBot.create(:admin_user)
      sign_in user
      visit admin_countries_path
      click_link "Library Countries", match: :first
      click_link "New Library Country", match: :first
      select source.name, from: "Library", match: :first
      select "Algeria", from: "Country"
      expect do
        click_button "Create"
      end.to change(SourceCountry, :count).by(1)
    end
  end
end

Expected behavior

Actual behavior

........................................

Failures:

  1) SourceCountry create can be created by an admin
     Failure/Error: click_link "Library Countries", match: :first

     NoMethodError:
       undefined method `=~' for [:source, :country]:Array
     # ./spec/features/source_country_spec.rb:11:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:66:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:[65] :in `block (2 levels) in <top (required)>'

Finished in 54.99 seconds (files took 28.58 seconds to load)
803 examples, 1 failure

Failed examples:

rspec ./spec/features/source_country_spec.rb:7 # SourceCountry create can be created by an admin
pirj commented 1 year ago

Thanks for reporting. What would happen if you run rspec with a --backtrace flag? I suspect that the problem might reside in rails_helper.rb:66, can you please share what is around this line?

wrburgess commented 1 year ago

results with --backtrace flag used

> `bundle exec rspec spec/features/source_country_spec.rb:7  --backtrace`

Run options: include {:locations=>{"./spec/features/source_country_spec.rb"=>[7]}}

Randomized with seed 39770

  1) SourceCountry create can be created by an admin
     Failure/Error: click_link "Library Countries", match: :first

     NoMethodError:
       undefined method `=~' for [:source, :country]:Array
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/order_clause.rb:7:in `initialize'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:206:in `new'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:206:in `apply_sorting'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:60:in `block in find_collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:59:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:59:in `find_collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:45:in `collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/inherited_resources-1.13.1/lib/inherited_resources/actions.rb:7:in `index'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/streaming.rb:13:in `index'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:215:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/rendering.rb:53:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:234:in `block in process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:107:in `run_callbacks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:233:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `block in instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/searchkick-5.1.1/lib/searchkick/controller_runtime.rb:15:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.0.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:151:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionview-7.0.4/lib/action_view/rendering.rb:39:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:188:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:251:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:852:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/tempfile_reaper.rb:15:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/etag.rb:27:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/conditional_get.rb:27:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/head.rb:12:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/session/abstract/id.rb:266:in `context'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/session/abstract/id.rb:260:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/cookies.rb:696:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:99:in `run_callbacks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/lograge-0.12.0/lib/lograge/rails_ext/rack/logger.rb:18:in `call_app'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:37:in `tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/method_override.rb:24:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/runtime.rb:22:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/static.rb:23:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/sendfile.rb:110:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/engine.rb:530:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:74:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:58:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:58:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:358:in `process_request'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:165:in `custom_request'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:114:in `get'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `get'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:80:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:55:in `process_and_follow_redirects'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:50:in `follow'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:249:in `follow_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:72:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:138:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:138:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:172:in `block in click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `block in perform_click_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/base.rb:84:in `synchronize'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `perform_click_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:171:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/actions.rb:42:in `click_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/session.rb:773:in `click_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/dsl.rb:52:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/dsl.rb:52:in `click_link'
     # ./spec/features/source_country_spec.rb:12:in `block (3 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:263:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:263:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-rails-6.0.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # ./spec/rails_helper.rb:66:in `block (3 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/strategy.rb:30:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/cleaners.rb:34:in `block (2 levels) in cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/cleaners.rb:35:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `cleaning'
     # ./spec/rails_helper.rb:65:in `block (2 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:259:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `run_examples'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:607:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/reporter.rb:74:in `report'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:115:in `run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:89:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:71:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:45:in `invoke'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/exe/rspec:4:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/rspec:25:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/rspec:25:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:491:in `exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:45:in `block in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:33:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/bundle:25:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/bundle:25:in `<main>'
F

Failures:

  1) SourceCountry create can be created by an admin
     Failure/Error: click_link "Library Countries", match: :first

     NoMethodError:
       undefined method `=~' for [:source, :country]:Array
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/order_clause.rb:7:in `initialize'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:206:in `new'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:206:in `apply_sorting'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:60:in `block in find_collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:59:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:59:in `find_collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/data_access.rb:45:in `collection'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/inherited_resources-1.13.1/lib/inherited_resources/actions.rb:7:in `index'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activeadmin-2.13.1/lib/active_admin/resource_controller/streaming.rb:13:in `index'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:215:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/rendering.rb:53:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:234:in `block in process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:107:in `run_callbacks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:233:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `block in instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `instrument'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/searchkick-5.1.1/lib/searchkick/controller_runtime.rb:15:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.0.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:151:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionview-7.0.4/lib/action_view/rendering.rb:39:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:188:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:251:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `serve'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:852:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/tempfile_reaper.rb:15:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/etag.rb:27:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/conditional_get.rb:27:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/head.rb:12:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/session/abstract/id.rb:266:in `context'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/session/abstract/id.rb:260:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/cookies.rb:696:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:99:in `run_callbacks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/lograge-0.12.0/lib/lograge/rails_ext/rack/logger.rb:18:in `call_app'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:37:in `tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `tagged'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/method_override.rb:24:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/runtime.rb:22:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.0.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/static.rb:23:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/sendfile.rb:110:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/engine.rb:530:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:74:in `block in call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:58:in `each'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-2.2.5/lib/rack/urlmap.rb:58:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:358:in `process_request'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:165:in `custom_request'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rack-test-2.0.2/lib/rack/test.rb:114:in `get'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `get'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:80:in `process'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:55:in `process_and_follow_redirects'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/browser.rb:50:in `follow'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:249:in `follow_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:72:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:138:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/rack_test/node.rb:138:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:172:in `block in click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `block in perform_click_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/base.rb:84:in `synchronize'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `perform_click_action'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:171:in `click'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/node/actions.rb:42:in `click_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/session.rb:773:in `click_link'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/dsl.rb:52:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/capybara-3.38.0/lib/capybara/dsl.rb:52:in `click_link'
     # ./spec/features/source_country_spec.rb:12:in `block (3 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:263:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:263:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-rails-6.0.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # ./spec/rails_helper.rb:66:in `block (3 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/strategy.rb:30:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/cleaners.rb:34:in `block (2 levels) in cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/database_cleaner-core-2.0.1/lib/database_cleaner/cleaners.rb:35:in `cleaning'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/forwardable.rb:240:in `cleaning'
     # ./spec/rails_helper.rb:65:in `block (2 levels) in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:352:in `call'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:259:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `run_examples'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:607:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `block in run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `map'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/reporter.rb:74:in `report'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:115:in `run_specs'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:89:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:71:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:45:in `invoke'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.0/exe/rspec:4:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/rspec:25:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/rspec:25:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:491:in `exec'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:45:in `block in <top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
     # /.../.../.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/libexec/bundle:33:in `<top (required)>'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/bundle:25:in `load'
     # /.../.../.asdf/installs/ruby/3.2.0/bin/bundle:25:in `<main>'

Finished in 1.54 seconds (files took 6.65 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/source_country_spec.rb:8 # SourceCountry create can be created by an admin

Randomized with seed 39770
wrburgess commented 1 year ago

Contents of rails_helper.rb:

ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../config/environment", __FILE__)
# Prevent database truncation if the environment is production or staging
abort("The Rails environment is running in production mode!") if Rails.env.production? || Rails.env.staging?
require "capybara/rspec"
require "money-rails/test_helpers"
require "rake"
require "rspec/json_expectations"
require "rspec/rails"
require "shoulda/matchers"
require "sidekiq/testing"
require "spec_helper"

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

ActiveRecord::Migration.maintain_test_schema!

capabilities = Selenium::WebDriver::Chrome::Options.new(
  args: %w[--headless --no-sandbox --disable-gpu],
  binary: ENV.fetch('GOOGLE_CHROME_SHIM', nil),
)

Capybara.register_driver :headless do |app|
  Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    capabilities: capabilities
  )
end

Capybara.javascript_driver = :headless
Capybara.server = :puma, { Silent: true }

RSpec.configure do |config|
  config.include Devise::Test::ControllerHelpers, type: :controller
  config.include ActiveJob::TestHelper
  config.include Rails.application.routes.url_helpers
  config.include StateMachinesRspec::Matchers, type: :model
  config.include Warden::Test::Helpers
  config.include ActiveSupport::Testing::TimeHelpers

  config.fixture_path = "#{::Rails.root}/spec/fixtures"
  config.infer_base_class_for_anonymous_controllers = false
  config.order = "random"
  config.use_transactional_fixtures = true

  config.mock_with :rspec do |c|
    c.syntax = [:should, :expect]
  end

  config.expect_with :rspec do |c|
    c.syntax = [:should, :expect]
  end

  config.before(:suite) do
    ActionMailer::Base.deliveries.clear
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)

    Clip.reindex
    Searchkick.disable_callbacks
  end

  config.around(:each) do |example|
    DatabaseCleaner.cleaning do
      example.run
    end
  end

  config.around(:each, search: true) do |example|
    Searchkick.callbacks(nil) do
      example.run
    end
  end

  config.after(:each) do
    Warden.test_reset!
  end
end

Shoulda::Matchers.configure do |config|
  config.integrate do |with|
    with.test_framework :rspec
    with.library :rails
  end
end

RSpec::Sidekiq.configure do |config|
  config.clear_all_enqueued_jobs = true
  config.enable_terminal_colours = true
  config.warn_when_jobs_not_processed_by_sidekiq = false
end
pirj commented 1 year ago

The exception happens here. It comes from this line in your spec file:

click_link "Library Countries", match: :first

that makes me think that the change matcher has no relation to this.

Do you mind debugging this a bit to figure out why there's a difference, why an array is passed as an argument to something that expects a string?

wrburgess commented 1 year ago

Yes. Will dig into this and let you know results

Thanks for taking a look!

wrburgess commented 1 year ago

I dug into it and discovered that the problem lies with the activeadmin framework (as you found) and an incorrectly named argument (on my part). In Ruby 3.1.3 the error is ignored. In Ruby 3.2.0 the error is captured and notice provided.

Based on this, I will close the issue.

Thank you for taking a look into my problem!