에 대한 정의되지 않은 메서드`방문 '나는이 stackoverflow 어딘가에 대답하지만, 내 인생에 대한 내 상황이 이미 여기에 쓰여진 것보다 다른 이유를 찾을 수 없습니다 확신합니다. spec_helper.rb가# <RSpec
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
gemfile 외모 모양에서 w RSpec에 사용
/삐
는1) report_cards#index must have 'Report Cards Index'
Failure/Error: visit '/'
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_4:0x007fcc3aa33960>
# ./spec/views/report_cards_view_spec.rb:7:in `block (2 levels) in <top (required)>'
/spec/views/report_cards_view_spec.rb는
같은require 'spec_helper'
describe "report_cards#index" do
it "must have 'Report Cards Index'" do
visit '/'
page.should have_content("something")
end
end
상단 라인 보이는 like
`source 'https://rubygems.org'`
gem 'rails', '3.2.7'
gem 'jquery-rails'
gem 'pg', '~> 0.14.0'
gem 'devise', '~> 2.1.2'
gem "quiet_assets", "~> 1.0.1"
gem 'thin'
gem 'bourbon'
gem "haml-rails"
gem "httparty", "~> 0.8.3"
gem "activerecord-import", "~> 0.2.10"
group :test, :development do
gem "rspec-rails", "~> 2.0"
gem 'capybara', '~>1.1.2'
gem "fabrication", "~> 2.2.0"
gem "launchy", "~> 2.1.2"
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end`
나는 예쁜 주니어이므로 쉽게 간다 :) - THX!
도를
을 추가했다 나는 capybara를 사용하는 것을 처음 사용하지만, [documentation here] (https://github.com/jnicklas/capybara#using-capybara-with-rspec)에 따르면 스펙은 spec/'spec/views' 폴더가 아닌'integration' 폴더에 있습니다. 폴더를 변경하거나 위의 설명 블록에': type => : request '를 추가하십시오. 확실하지 않기 때문에 답변으로 추가하지 않았습니다. – Kashyap