natritmeyer/site_prism — pull request #60 by tgaff (2014-01-22 05:35:36+00:00)
Title: Fix an issue in which passing nil to #wait_for_element causes an error.

- Capybara expects a float, not nil.

As called out in the readme, this should work:
`@page.wait_for_foobar nil, count: 42`

````
@results_page = SearchResults.new
# ...
@results_page.has_search_results? :count => 25
# OR
@results_page.search_results :count => 25
# OR
@results_page.wait_for_search_results nil, :count => 25 # wait_for_ expects a timeout value to be passed as the first parameter or nil to use the default timeout value.
````

We were actually passing nil as the timeout though, which worked as long as it didn't actually have to wait for the element. In that case you'd get:
````
comparison of Float with nil failed (ArgumentError)
./lib/site_prism/page.rb:64:in `element_exists?'
````

So I'm defaulting it to the Capybara.default_wait_time if nil is passed. I think that's the expected behavior here. In general I don't like that and think we ought to key all values, but this follows what's in the current readme.

Tests:
````

Scenario: Waiting on a set of elements # features/page_elements_interaction.feature:19
When I navigate to the home page # features/step_definitions/navigation_steps.rb:1
Then I can wait a variable time for elements to appear # features/step_definitions/page_element_interaction_steps.rb:136
Then I can wait a variable time and pass specific parameters # features/step_definitions/page_element_interaction_steps.rb:141

4 scenarios (4 passed)
10 steps (10 passed)
0m2.749s
````