[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec

Development environment

・ Ruby: 2.5.7 Rails: 5.2.4 ・ Rspec-rails: 4.0.1 ・ Capybara: 3.32.2 ・ Vagrant: 2.2.7 -VirtualBox: 6.1 ・ OS: macOS Catalina

Cause

Capybara cannot be read.

Solution

1. Read with require

spec_helper.rb


require 'capybara/rspec' #Postscript
RSpec.configure do |config|
end

2. If solution 1 doesn't help, force read with DSL

spec_helper.rb


require 'capybara/rspec'
RSpec.configure do |config|
  config.include Capybara::DSL #Postscript
end

Recommended Posts

[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec
How to solve the unknown error when using slf4j in Java
Error when using rails capybara
How to set environment variables when using Payjp with Rails
[Rails / RSpec] How to deal with element has zero size error
[Rails 5] How to display the password change screen when using devise
[Rails] How to use the map method
[Rails] How to solve the time lag of created_at after save method
[Rails] How to solve "Uglifier :: Error: Unexpected character'`'"
How to get the query string to actually issue when using PreparedStatement with JDBC
[Rails] How to operate the helper method used in the main application with Administrate
How to add characters to display when using link_to method
[With back tricks] How to introduce React to the simplest Rails
How to test a private method with RSpec for yourself
How to specify db when creating an app with rails
How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
Things to keep in mind when using Sidekiq with Rails
How to solve the problem when the value is not sent when the form is disabled in rails and sent
[Rails] What to do if you can't get an error message with the errors method
[Rails] What to do when the view collapses when a message is displayed with the errors method
How to use the link_to method
How to use the include? method
How to use the form_with method
How to deal with 405 Method Not Allowed error in Tomcat + JSP
[Rails] How to introduce kaminari with Slim and change the design
I tried to understand how the rails method "redirect_to" is defined
[Rails] How to omit the display of the character string of the link_to method
I tried to understand how the rails method "link_to" is defined
How to get along with Rails
[Rails 6] destroy using the resources method
Method definition location Summary of how to check When defined in the project and Rails / Gem
How to write the view when Vue is introduced in Rails?
[Ruby on Rails] How to log in with only your name and password using the gem devise
[Rails] How to solve the problem that the default image is overwritten when editing without uploading the image [Active Storage]
[Ruby on Rails] When logging in for the first time ・ How to split the screen in half using jQuery
How to decorate the radio button of rails6 form_with (helper) with CSS
[Rails] I was addicted to the nginx settings when using Action Cable.
[Rails] About the error when displaying the screen due to the autofocus of the form
Gorigori beginners summarized how to operate the database using rails console Ntiunus
[Docker] How to solve the error function not implemented @ io_fread ~ [Super easy]
[Rails] "pry-rails" that can be used when saving with the create method
[Rails] How to get the user information currently logged in with devise
How to compare only the time with Rails (from what time to what time, something like)
How to solve the local environment construction of Ruby on Rails (MAC)!
How to display the text entered in text_area in Rails with line breaks
[Ruby On Rails] How to search the contents of params using include?
[Rails] How to apply the CSS used in the main app with Administrate
How to reference a column when overriding the column name method in ActiveRecord
[Rails] How to upload images using Carrierwave
[Java] How to compare with equals method
[Rails] How to use rails console with docker
[Java] How to use the toString () method
[Rails] How to display error messages individually
How to resolve errors when installing Rails 5.1.3
RSpec error resolution undefined method `feature'for RSpec: Module
Get the error message using the any? method
How to implement image posting using rails
What to do when undefined method ʻuser_signed_in?'
[Rails] How to use helper method, confimartion
[Rails] How to handle data using enum
How to build Rails 6 environment with Docker