On 2 Apr 2009, at 22:20, Brandon Olivares wrote:

Hi,

-----Original Message-----
From: [email protected] [mailto:rspec-users-
[email protected]] On Behalf Of Matt Wynne
Sent: Thursday, April 02, 2009 3:55 PM
To: rspec-users
Subject: Re: [rspec-users] Problem with Custom matcher and Blocks


#have_selector is part of webrat. Have you required the appropriate
files so that method is visible to your new matcher class?


Oops, forgot that.

OK, so I added:

Require 'webrat/core/matchers/have_selector'

On the first line, and directly within the class:

Include Webrat::Matchers

Is this correct?

Think so. Did the error go away?

OK, so now all 16 examples pass. But one of them should be failing -- the
one with the name. Do you see any reason that is still passing?

Again my matches? Method is as follows:

   def matches? response
     response.should have_selector('form#%s' % [...@id]) do |form|
       !...@block or @block.call form
     end
   end

I don't think you want to be using #should here. If that fails it will raise an exception but the expected behaviour of a matcher is to return true / false from #matches? so that will be one problem you have. Try just hard-coding the #matches? method to return false and see if you get one of your tests to fail.

What are you imagining that #response is going to return in this instance?

Matt Wynne
http://beta.songkick.com
http://blog.mattwynne.net



_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to