[rspec-users] Problem with Custom matcher and Blocks
programmer2188 at gmail.com
Thu Apr 2 17:56:27 EDT 2009
Well, I looked in the Webrat matchers code, and saw they also have a block
argument to the matches? Method, though I don't know why. So I copied what
they did there, and got a bit more informative output. Unfortunately now I
have more errors.
Before I continue, do you know why I have to include &block as the second
argument to `matches?'?
So now it won't recognize my subject field. The error is something like
'/contact/index the contact form before it has been submitted the subject
dropdown box should have a feedback option' FAILED
expected following output to contain a <select[id=subject]/> tag:
<form action="/contact.html" id="contact" method="post">
<select id="subject" name="subject"><option value=""></option>
That example is something like:
it "should have a feedback option" do
response.should have_a_contact_form do |form|
form.should have_selector('select', :id => 'subject') do
subject.should have_selector('option', :content => 'Feedback')
end # it "should have a feedback option"
Thanks for any help.
More information about the rspec-users