[rspec-users] controller_name with dynamic controllers

David Chelimsky dchelimsky at gmail.com
Mon Mar 19 08:16:35 EDT 2007


On 3/19/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>
> Thanks for the reply.  Actually, both work, but I was making the dumb
> move of using be_equal instead of be ==, so I was getting a failing
> spec.

FWIW, be == is not really supported. You should just use == ...

  actual.should == expected

or

  actual.should equal(expected)

if you want object identity.

>
> Scott
>
>
> On Mar 19, 2007, at 7:10 AM, David Chelimsky wrote:
>
> > On 3/19/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> >>
> >> I'm writing a controller which should only be inherited from,
> >> something like the generic crud controller seen here: http://
> >> geekonomics.blogspot.com/2006/07/crud-and-shared-controllers.html
> >>
> >> Now, in my spec, I would like to create a controller which inherits
> >> from the generic CRUDController, without actually creating the
> >> controller.  This controller is *only* for testing.
> >>
> >> How can I do this?  I can't do something like this:
> >>
> >> Object.const_set("MyCrudController", Class.new(CRUDController))
> >
> > unless defined?(TestingCrudController)
> >   TestingCrudController = Class.new(CRUDController)
> > end
> >
> >>
> >> because the method "controller_name" will complain of setting the
> >> constant twice.
> >>
> >> Any ideas?
> >>
> >> Best,
> >>
> >> Scott Taylor
> >>
> >> _______________________________________________
> >> rspec-users mailing list
> >> rspec-users at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/rspec-users
> >>
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list