[rspec-users] render_with_layout not working with RSpec 2 + Rails 3 + shoulda 2.11.3

Evgeniy Dolzhenko dolzenko at gmail.com
Tue Sep 7 05:21:09 EDT 2010


My 2cents: while upgrading my test suite I replaced all such cases with just
it { should render_template("layouts/application") }

Worked for me.

On Mon, Sep 6, 2010 at 7:40 PM, Amiruddin Nagri <amir.nagri at gmail.com> wrote:
> Hello,
>
> I am trying to assert that my controller is rendered with particular layout
> file
>
>   it "should render application layout" do
>     get :index
>     should render_with_layout('application')
>   end
>
> but it is giving error like
>
>      undefined method `layout' for nil:NilClass
>      #
> /Users/userX/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in
> `method_missing'
>      #
> /Users/userX/.rvm/gems/ruby-1.9.2-p0/gems/shoulda-2.11.3/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb:67:in
> `rendered_layouts'
>      #
> /Users/userX/.rvm/gems/ruby-1.9.2-p0/gems/shoulda-2.11.3/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb:55:in
> `rendered_with_layout?'
>      #
> /Users/userX/.rvm/gems/ruby-1.9.2-p0/gems/shoulda-2.11.3/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb:31:in
> `matches?'
>      # ./spec/controllers/some_controller_spec.rb:6:in `block (2 levels) in
> <main>'
>
>
> I have uploaded a sample app where the issue can be produced here ->
> http://github.com/anagri/shoulda_rspec_sample
>
> What am I doing wrong ? is it a good idea to jump on Rails 3 while issues
> with a lot of essential plugins still being ironed out ?
>
> Thanks,
> Amiruddin Nagri
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list