4
많은 통합 테스트에서 Capybara를 사용할 수 없습니다.Capybara :: ElementNotFound : xpath "/ html"을 webrat없이 찾을 수 없습니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
그래서 나는 have_content()
선택기를 사용하려고하면, 그것은 다음과 같은 오류 발생합니다 :
Failure/Error: page.should have_content("HELLO")
Capybara::ElementNotFound:
Unable to find xpath "/html"
의 일부를 내가 특정 페이지를 방문 할 때
, 나는 다음과 같은 HTML을 얻을 내 애플 리케이션의 페이지를 잘 방문 할 수 있지만 다른 것들은 내가 할 수 없어. 심지어 어떤 장소에서 작업 페이지, 그리고 다른 사람에있다 :이 동시에 카피 바라와 webrat를 사용할 때 발생할 수있는 오류라고 this post 읽을
require 'spec_helper'
describe HomeController do
it "shows the website description" do
visit root_path
puts page.html.length # ==> 108 (no html)
...
end
end
require 'spec_helper'
describe FlowsController do
it "should do stuff" do
visit root_path
puts page.html.length # ==> 4459, works even if the exact same one didn't work in home_controller_spec!
visit flows_path
puts page.html.length # ==> 3402, works
visit new_user_session_path
puts page.html.length # ==> 3330, works
within("form#new_user") do
fill_in 'Email', :with => '[email protected]'
fill_in 'Password', :with => 'password'
click_on 'Sign in'
end
puts page.html.length # ==> 108, No html
end
end
. 그러나 여기
내 Gemfile입니다 ... 난 전혀 webrat을 사용하지 않는, 그리고 난 여전히 오류가 발생합니다 :source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'pg'
gem 'thin'
gem 'devise'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
# Add rspec for testing
group :test, :development do
gem "rspec-rails", "~> 2.0"
gem "capybara"
gem "factory_girl_rails"
end
gem 'jquery-rails'