question about rspec assigns

  • Thread starter Daniel Higginbotham
  • Start date
D

Daniel Higginbotham

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
 
W

Wilson Bilkovich

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.
 
D

Daniel Higginbotham

Thanks!

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

Daniel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top