[rspec-users] Cucumber - how to spec a quick search box

Joseph Wilk josephwilk at joesniff.co.uk
Tue Nov 18 05:44:39 EST 2008

Mikel Lindsaar wrote:
> Hello all.
> Wondering if anyone else has solved this.
> Some websites (including the intranet app I am working on) have a form 
> in the top corner of the site that is buttonless. If you focus on this 
> form enter text and hit enter, it submits.  usually used for quick 
> search boxes.
> Question, has anyone managed to tie that into a cucumber feature?
> Scenario: Using the quick search box
>   Given I am logged in
>   And I visit the home page
>   And there is someone called 'Bob Smith' to search for
>   When I put 'Bob Smith' into the quick search box
>   And I hit enter
>   Then I should be shown the search results page
>   And there should be 'Bob Smith' on the page
> it's the 'And I hit enter' that is bugging me :)
> Any ideas?
I've encountered the same problem. I generally try and pull the 
abstraction up a bit a say something like:

When I submit a quick search for 'Bob Smith'

But here I'm assuming that its not really important to the customer how 
they submit the form just that they can.

Joseph Wilk

More information about the rspec-users mailing list