4
我正在嘗試使用Capybara編寫Rspec請求規範。似乎所有東西都正常工作除了水豚看到頁面爲空白。爲什麼Capybara無法看到此頁面的內容?
好的跡象:
- 該頁面加載在瀏覽器中
- 尾礦日誌精細顯示,正確的觀點是試運行期間呈現
- 任何記錄語句我把意見執行
- 如果我使用
assert_select "h1", :text => "hello world"
,測試通過。
不良苗頭:
- 如果我使用
page.should have_content('hello world')
,它失敗了,說Capybara::ElementNotFound: Unable to find xpath "/html"
- 如果我做
$stdout.puts page.html
,這是除了一個DOCTYPE
我的測試看起來像空這個:
describe "working with foos" do
it "should have a 'new foo' form" do
get '/foos/new'
assert_select 'h1', text: 'hello world' # passes
page.should have_content('hello world') # fails
$stdout.puts page.html # empty except for a doctype
end
end
這裏有什麼問題?