Linus
Linus

Reputation: 4783

RSpec / Capybara debugging

I'm trying to test the ability to vote on an event. I've created the event via factory_girl. When the user participated to the event, he should have the ability to vote.

The vote button is visible to capybara as well as visible to me when I manually test for its presence in the browser. When I use click_on "vote", there is no error. Now comes the weird thing. When I manually test the vote button via the browser, I now see the vote form and have a /vote/... path in my browser. When I use click_on "vote" in Capybara and check for the path, the path equals the start page.

I've tried everything I can think of to figure out why Capybara is hitting the wrong path.

My question is, is there a possibility to see some 'advanced' logging or something else? Like why a redirect happened or something else?

Upvotes: 1

Views: 1178

Answers (1)

Swayam
Swayam

Reputation: 600

You can use byebug to step through your spec. Also, I find chromedriver to be very useful. It runs your tests in chrome environment so you can eyeball your test and confirm that it is doing what it is supposed to.

Byebug: https://github.com/deivid-rodriguez/byebug

Chrome driver: http://collectiveidea.com/blog/archives/2011/09/27/use-chrome-with-cucumber-capybara/

Upvotes: 2

Related Questions