thoughtbot/capybara-webkit — Issue #205: Tests fail unless page object is accessed
Author: willrjmarshall
Created: 2011-11-04 01:10:11+00:00
State: open

I'm having a strange issue using Capybara-webkit with Rspec 2.

I have a "before do" block that looks like this:

```ruby
before do
visit "/"
click_link "Log in"
fill_in "Email", :with => user.email
fill_in "Password", :with => "password"
click_button "Sign in"
end

it "should show me a link to my profile on the home page" do
visit "/"
page.should have_content "My profile"
end
```

This fails, as the login is not completed (although it should work).

However, if I access the page object at the end of the before block, e.g.
```page.should_not have_content "NOTONTHEPAGE"
Then the login succeeds and this test passes.

It looks like Capybara-webkit requests aren't actually being run until the page object is accessed...