前提・実現したいこと
rails testを正常に動作させたいです。
rails tutorialの第3章に従いリスト3.15まで実行しました。引数が一致しておらず、node_filter.rbの9行目からがエラー元であると解釈しています。
発生している問題・エラーメッセージ
エラーメッセージ /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filters/node_filter.rb:9:in `initialize': wrong number of arguments (given 4, expected 3) (ArgumentError) from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:117:in `new' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:117:in `add_filter' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:20:in `block in node_filter' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:19:in `each' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:19:in `node_filter' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector.rb:168:in `block in <main>' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:15:in `instance_eval' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:15:in `initialize' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:79:in `new' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector/filter_set.rb:79:in `add' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara/selector.rb:167:in `<main>' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara.rb:448:in `<module:Capybara>' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/capybara-3.28.0/lib/capybara.rb:9:in `<main>' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:66:in `block (2 levels) in require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:61:in `each' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:61:in `block in require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:50:in `each' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:50:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/bundler.rb:174:in `require' from /home/vagrant/test_app/sample_app/config/application.rb:7:in `<top (required)>' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `require' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `preload' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run' from /home/vagrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>' from <internal:/home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/home/vagrant/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from -e:1:in `<main>'
該当のソースコード
# frozen_string_literal: true require 'capybara/selector/filters/base' module Capybara class Selector module Filters class NodeFilter < Base def initialize(name, matcher, block, **options) super @block = if boolean? proc do |node, value| error_cnt = errors.size block.call(node, value).tap do |res| add_error("Expected #{name} #{value} but it wasn't") if !res && error_cnt == errors.size end end else block end end def matches?(node, name, value, context = nil) apply(node, name, value, true, context) rescue Capybara::ElementNotFound false end end end end end
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
言語:ruby
FM:rails
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/01/28 05:48
2021/01/28 08:08