I am trying to write custom matchers for RESTful behavior of my controllers.

I have created two matchers
*be_created *(
http://github.com/anagri/rspec_matchers/blob/80d0d021a7ad1e9af2ff18e79b80c004324abdc7/spec/support/http_status_matcher.rb)
*have_created_resource *(
http://github.com/anagri/rspec_matchers/blob/80d0d021a7ad1e9af2ff18e79b80c004324abdc7/spec/support/restful_resource_matcher.rb)

In be_created, I check for the status code to be 201 and a location of the
new resource. In have_created_resource, i also pass in the resource that was
created and verify it exists (non nil check) as well as that it passes the
be_created criteria.

Github commit =>
http://github.com/anagri/rspec_matchers/commit/80d0d021a7ad1e9af2ff18e79b80c004324abdc7

I am getting an error saying be_created not found. Obviously, be_created is
not in scope but if I fix it and include the required module it fails for
be_nil not found.
I am finding this way of reusing the matchers not correct.

Is there a standard way of re-using matchers inside matchers ? Have anybody
tried it out ?

Regards,
Amiruddin Nagri,
Bangalore, 560008, KA
India

Y! IM : amir_na...@yahoo.com
GTalk : amir.na...@gmail.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to