[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
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
How to automatically generate ER diagram when migrating with Rails6
[With back tricks] How to introduce React to the simplest Rails
How to specify db when creating an app with rails
How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
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
[Rails] How to convert the URI of the image sent by http to https when using Twitter API
How to use the include? method
How to use the form_with method
[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
[Rails 6] destroy using the resources method
Method definition location Summary of how to check When defined in the project and Rails / Gem
[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
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)!
[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
How to put out the error bundling
[Note] How to get started with Rspec
[Java] How to use the toString () method
[Rails] How to display error messages individually
How to resolve errors when installing Rails 5.1.3
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
How to build Rails 6 environment with Docker
[Ruby On Rails] When a model unit test is performed with RSpec using FactoryBot, an error occurs because the foreign key is not entered.
How to resolve the error'ActionView :: Template :: Error (The asset "application.css" is not present in the asset pipeline.'" When precompiling Rails assets
[Rails] How to read the XML file uploaded from the screen with Hash type
[Rails6] How to connect the posting function generated by Scaffold with the user function generated by devise
[Laravel] How to deal with out of memory error when composer require [Docker]
[Rails] How to register multiple records in the intermediate table with many-to-many association
[Heroku] How to solve when an error is displayed on git push heroku master
[Ruby on Rails] How to Japaneseize the error message of Form object (ActiveModel)
How to solve the font specification problem dedicated to using IntelliJ IDEA (Win x64)