2013-10-30 13 views
0

我正在玩硒通過rspec周圍,但不滿意,我看到了poltergeist的建議。當我試着用我的測試來運行它時,似乎poltergeist驅動程序沒有顯示它應該在哪裏。我有點困惑,機架測試適用於極端主義者,但我嘗試了很多不同的東西。然後我找到了這個簡單的例子,並試圖讓它工作,但仍然沒有運氣。我在Windows上使用jruby。試圖得到簡單的poltergeist示例運行

我使用的例子在這裏找到:https://gist.github.com/pzol/1607842 我感動我的代碼到一個文件中,沒有此情況下,不規範的輔助

我沒有安裝phantomjs和跑phantomjs和它一點點的Hello World示例在我的道路

require 'rspec' 
require 'capybara/rspec' 
require 'capybara/poltergeist' 

Capybara.javascript_driver = :poltergeist 

Capybara.register_driver :poltergeist do |app| 
    Capybara::Poltergeist::Driver.new(app, debug: true) 
end 

describe 'poltergeist', :type => :request, :js => true do 

    it 'should find github poltergeist in google' do 
    visit 'http://www.google.com/' 
    fill_in "q", :with => "github poltergeist" 
    click_button "btnK" 
    page.should have_content 'jonleighton/poltergeist' 
    end 
end 

的JRuby -S rspec的騷靈,test2.rb ˚F

次失敗:

1)騷靈應該找到在谷歌 故障/錯誤的github騷靈:訪問 'http://www.google.com/' NoMethodError: 未定義的方法visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x4324 4fd9> # ./poltergeist-test2.rb:18:in(根)」

在0.01秒內 1例如,1次失敗成品

失敗的例子:

rspec的./poltergeist-test2.rb:17#騷靈應該找到GitHub的騷靈在 谷歌

回答

1

嗯,嗯,我更多一些看着水豚文檔,我改變了這一行:

describe 'poltergeist', :type => :request, :js => true do 

這條線,在那裏我做:類型爲:功能,現在它似乎是確定..

describe 'poltergeist', :type => :feature, :js => true do 

似乎在我的谷歌搜索有一天,我在電視上看到的東西,但不知道在那一刻我不清楚有什麼區別,但我取得進展似乎

+0

原因這是水豚只加載f或':feature'規格,這是您在此處做出的唯一更改。 – itslittlejohn

相關問題