I just switched the capybara-driver from
webkit in my Rails 3.2.2 application / WAT
I was so tired watching this firefox-window popping up several times each time running the rspec-suite. With
capybara-webkit it’s so much faster and so less boring now.
On Mac OS X
… I had to install some things, tho. I did this from within my
rvm-environment for the WAT-project.
cd ~/Development/wat # move to your project's root-path rvm use 1.9.2-p290@rails32 # use the propper rvm-environment ## change the two lines above to fit your needs rvmsudo brew install Qt rvmsudo gem install capybara-webkit
And now it worked just as mentioned in all the docs and blogs out there:
Add the gem to your
group :test do ... gem 'capybara-webkit' ... end
And finally config capybara to use the webkit-driver.
spec/spec_helper and add the following lines
Here is an example how you can test a controller with Ajax-requests
it "switches personal information and authentication providers", :js => true, :driver => :webkit do visit user_path(@user1) click_link 'Personal information' page.should have_content "No personal information stored yet" click_link 'Assign authentication providers' page.should have_content "Identity" end
click_link actions clicks on a link with
:remote => true which end’s up in a remote-call to the server. If I remove the
:js => true-parameter from the spec the test will fail obviously.