[rspec-users] RSpec 2/Rails 3 - content_for in view specs

jared jared at yourelevation.com
Fri Jun 8 21:21:16 UTC 2012


This worked in Rails 3.1 but view.instance_variable_get(:@_content_for) is 
nil in Rails 3.2

Anybody have a solution for this in Rails 3.2?

Thanks!

Jared

On Saturday, August 28, 2010 4:12:53 PM UTC-7, Michael Schuerig wrote:
>
> On Thursday 19 August 2010, Dylan Markow wrote:
> > Is there a way to get to the content captured in a "content_for"
> > block through my view specs, or at the very least get my "render"
> > call to use the full layout?
>
> Try defining a method like this in your spec
>
>   def content_for(name)
>     view.instance_variable_get(:@_content_for)[name]
>   end
>
> and then
>
>   content_for(:sidebar).should ...
>
>
> Michael
>
> -- 
> Michael Schuerig
> mailto:michael at schuerig.de
> http://www.schuerig.de/michael/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120608/b25561fb/attachment.html>


More information about the rspec-users mailing list