[rspec-users] Specifying the contents of a date selector

Ashley Moran work at ashleymoran.me.uk
Tue Jan 16 11:51:11 EST 2007

Another n00b question (can  you tell I don't normally write view code  

I'm using the date_select form helper to give me three select popups,  
(day, month, year).  I want to specify that these exist and are set  
to today's date

I've tried this:

     response.should_have 'form > p > select 
[name="gap_quick_quote_parameters[purchase_date(3i)]"] > option',
                           :attributes => { :value => '16', :selected  
=> 'selected' },
                           :content => '16'

But it fails, saying:

     Invalid selector: "] > option

Is this a limitation of the CSS selector?  I can't think of a way of  
phrasing the spec without trying to select children of the select  
elements.  I want to avoid specifying that SOME select popup on the  
page has a value equal to today's day, month, or year.


More information about the rspec-users mailing list