nathan.sutton at gmail.com
Thu Jan 10 19:48:09 EST 2008
You should browse over how shoulda does it here:
fowlduck at gmail.com
On Jan 10, 2008, at 6:29 PM, Jonathan Leighton wrote:
> On Thu, 2008-01-10 at 18:47 -0500, Josh Knowles wrote:
>> On 1/10/08, Nathan Sutton <nathan.sutton at gmail.com> wrote:
>>> Hmm, that includes a good number of them, but there's still the
>>> restful resource to think about, which is in my opinion the most
>>> valuable one. Would you consider the addition of a restful resource
>>> matcher similar to shoulda's?
>> Yes. If you work something up I'd happily add it. Unfortunately I
>> don't have the need/time/desire to do it myself right now though.
> My reservation with the idea of "should be restful" is that you have
> assume an awful lot about how the controller is implemented. That's
> if you use scaffolding excessively but if you actually write your own
> code (!!) things quickly start to deviate from the trodden path.
> Recently I have been writing my controller specs a bit like this (I
> some support code to enable it):
> describe PostsController do
> controller_name :posts
> describe "when a post is viewed and the current user is an admin" do
> log_in :as => :admin
> get :show, :id => 42
> describe "when a post is edited by a normal user" do
> log_in :as => :prole
> get :edit, :id => 23
> it_should_redirect_to "the post's page", :at => "post_path(@post)"
> Some of the above is me using my creative license but you get the
> Just thought it might spark some ideas/opinions... it's certainly
> not a
> perfect implementation/API but I've found the general idea quite
> I personally think this is the right level at which to make the
> abstraction - you are still specifying the behaviour explicitly, just
> writing less code when doing it.
> Jonathan Leighton
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users