I was playing around with selenium via rspec but was dissatisfied and I saw recommendations for poltergeist. When I try to run it with my tests, it seems like the poltergeist driver doesn't show up where it should. I was a little confused where rack test fits in with poltergeist but I tried many different things. I then found this simple example and tried to get that to work but still no luck. I am using jruby on windows.
I am using the example found here: https://gist.github.com/pzol/1607842 I moved all my code into one file, there is no spec helper for this case
I did install phantomjs and ran a little hello world example for phantomjs and it is in my path
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 poltergeist-test2.rb F
Failures:
1) poltergeist should find github poltergeist in google
Failure/Error: visit 'http://www.google.com/'
NoMethodError:
undefined method visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x4324
4fd9>
# ./poltergeist-test2.rb:18:in
(root)'
Finished in 0.01 seconds 1 example, 1 failure
Failed examples:
rspec ./poltergeist-test2.rb:17 # poltergeist should find github poltergeist in google