[rspec-users] Including matchers in Cucumber

Ashley Moran ashley.moran at patchspace.co.uk
Mon Sep 22 07:21:35 EDT 2008


Hi

Where do you include matcher modules in Cucumber so they don't pollute  
Object?  ie so

   module TwitterMatchers
     class HaveUserStatus
       # ...
     end

     def have_user_status(user, status)
       HaveUserStatus.new(user, status)
     end
   end

is only visible in

   Then "it should push an announcement to Twitter" do
     t = Twitter::Base.new("dummy_user", "secret", :api_host =>  
"localhost", :api_port => 7002)
     t.should have_user_status("followme_ann", "Story title  
#@num_stories")
   end

(Actually I'm not convinced it's necessary in this case, but anyway.)

I had a look at the Cucumber examples but none of them use custom  
matchers.

Thanks
Ashley


-- 
http://www.patchspace.co.uk/
http://aviewfromafar.net/





More information about the rspec-users mailing list