Help us understand the problem. What is going on with this article?

RSpec3.2でCapypara使ってて undefined method `visit’と出る時

More than 5 years have passed since last update.

railstutorial3章を消化しててぶつかったところのメモ。
今使ってるrspecのバージョンが3.2だからか、rails generate integration_test static_pages で出力されるrspecコードが記載と異なっている。

そのまま動かすと、「undefined method `visit’」と出る。

対処法は、こちらのページを参考
Capyparaで undefined method visit’と出る時の対処法

Gemfile
group :test do
  gem 'selenium-webdriver', '2.35.1'
  gem 'capybara', '2.2.0' #2.2.0に修正
end
spec/rails_helper.rb
#以下を追記
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)

require 'rspec/rails'
require 'capybara/rspec'
require 'rspec/autorun'

RSpec.configure do |config|
  ()
  config.include Capybara::DSL
end

取り敢えずこの対応で、
bundle exec rspec spec/requests/static_pages_spec.rb
は動いた。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした