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

David Chelimsky dchelimsky at gmail.com
Tue Jan 16 12:27:57 EST 2007

On 1/16/07, Ashley Moran <work at ashleymoran.me.uk> wrote:
> Another n00b question (can  you tell I don't normally write view code
> yet???)...
> 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.

The syntax you are using invokes a preliminary port of assert_select
that is not officially supported yet.

That said, take a look at the tests for the selector. All the examples
that use double quotes have them escaped:


I'm guessing you could also do this:


or even this:


Let us know what works, if any of those suggestions.


> Ashley
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list