Capybara/Poltergeist causing unexpected results in request spec in Rails 3.2 app -
is there alternative can use capybara's save_and_open_page
? have written request spec test user signup form. upon successful signup, test should yield, test should passing, it's not.
yet when save_and_open_page
@ end, form fields blank. can mirror in development environment doing data entry myself , passes, struggling understand what's wrong. can't afford let go because critical test.
i've been doing tdd little while, tips or tricks stack (capybara , poltergeist) helpful. not having similar difficulties in other request specs using same stack.
here request spec:
it 'allows user subscribe', js: true visit root_url click_link "pricing" click_button "subscribe", match: :first fill_in "first name", with: "marky" fill_in "last name", with: "mark" fill_in "company", with: "the funky bunch" fill_in "subscription_email", with: "marky.mark@thefunkybunch.com" fill_in "password", with: "mystring" fill_in "password confirmation", with: "mystring" fill_in "credit card number", with: "4242424242424242" fill_in "security code on card (cvv)", with: "123" select "july", from: "card expiration" select "2014", from: "card_year" check "chkaccept" click_button "subscribe myapp" # line below fails, save_and_open page shows blank form current_path.should_not eq(new_subscription_path) page.should have_content("thank you") end
poltergeist provides screenshots can used instead of save_and_open_page:
save_screenshot('/path/to/file.png', :full => true)
however comment "# line below fails" seems consistent "save_and_open page shows blank form".
Comments
Post a Comment