views:

36

answers:

1

I have a form that has this

<%= submit_tag 'Search Event' %>

and a cucumber step that says

And I should see "Search Event"

but this step fails.. why is that?

Here is the error i get

expected #has_content?("Search Event") to return true, got false (RSpec::Expectations::ExpectationNotMetError)
+1  A: 

I think this doesn't work because the button label is not text content -- it's the value attribute of the submit button.

Jeremy Weiskotten
i thought so. what is the best way to check for existence of a button?
so1o
You can do this by writing your own step that uses Webrat (or Capybara) to find the button. Or, instead of checking for the existence of a button, you can just (try to) use the button with "Then I press..." to submit the form and confirm the results.
Jeremy Weiskotten