[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

question about rspec assigns

Daniel Higginbotham

11/15/2006 1:04:00 AM

Hi folks,

I'm using rspec for a Rails project and keep seeing the "assigns" method in
the "writing specs" portion of the documentation, yet I don't see "assigns"
in the rdoc and I can't seem to find an explicit definition what it does.
Would someone be able to tell me what exactly "assigns" does?

Thanks!
Daniel

2 Answers

Wilson Bilkovich

11/15/2006 1:11:00 AM

0

On 11/14/06, Daniel Higginbotham <daniel@flyingmachinestudios.com> wrote:
> Hi folks,
>
> I'm using rspec for a Rails project and keep seeing the "assigns" method in
> the "writing specs" portion of the documentation, yet I don't see "assigns"
> in the rdoc and I can't seem to find an explicit definition what it does.
> Would someone be able to tell me what exactly "assigns" does?
>

Assigns is a feature RSpec borrows from the regular Rails test/unit helpers.
In a controller spec, assigns[:blah] points at the @blah instance variable.
Useful for setting expectations on what the controller will do with
your request.

Also, this is probably better suited for the RSpec mailing list.

Daniel Higginbotham

11/15/2006 1:25:00 AM

0

Thanks!

Sorry for asking here - the rspec forum on rubyforge
(http://rubyforge.org/forum/?gr...) was pretty barren, but now I see
how to joing the mailing list - thanks again!

Daniel

On Tuesday 14 November 2006 3:10 pm, Wilson Bilkovich wrote:
> On 11/14/06, Daniel Higginbotham <daniel@flyingmachinestudios.com> wrote:
> > Hi folks,
> >
> > I'm using rspec for a Rails project and keep seeing the "assigns" method
> > in the "writing specs" portion of the documentation, yet I don't see
> > "assigns" in the rdoc and I can't seem to find an explicit definition
> > what it does. Would someone be able to tell me what exactly "assigns"
> > does?
>
> Assigns is a feature RSpec borrows from the regular Rails test/unit
> helpers. In a controller spec, assigns[:blah] points at the @blah instance
> variable. Useful for setting expectations on what the controller will do
> with your request.
>
> Also, this is probably better suited for the RSpec mailing list.