[rspec-users] Best way to specify an HTML element inside another

Ashley Moran work at ashleymoran.me.uk
Thu Jan 18 08:57:29 EST 2007


Hi

I know should_have is preliminary but I can't resist using it...

I have a form that contains a date select (Rails-generated).  I want  
to specify that the default value for each popup menu is correct

The best I can manage is this:
     response.should_have "form > p > select[name='quote_parameters 
[purchase_date(3i)]'] > option[selected='selected']", :text => '16'

I really want to specify two attributes for the <option> tag, like  
option[selected='selected',value='16'] - is there any syntax that  
allows this?

Ashley


More information about the rspec-users mailing list