I have an rspec test failing, but in development, when I perform the actions myself, the page renders correctly.
Here's the snippet:
describe "sign up process" do
let (:admin1) { FactoryGirl.create(:admin) }
describe "with valid information"
before do
visit new_admin_registration_path
fill_in "Email", with: admin1.email
fill_in "Password", with: admin1.password
fill_in "Password confirmation", with: admin1.password_confirmation
click_button "Sign up"
end
it { should have_selector('div.alert') }
end
It's not finding that selector at all, but I confirmed it exists when viewing the source using the development environment.
What I'd like to be able to do is inspect the page that's rendering to see what I'm missing. Is there a way to do that?
Capybara has a method save_and_open_page
which will open a new browser window with the current state of the page (it requires the launchy
gem).
For example:
before do
...
click_button "Sign up"
save_and_open_page
end