I just started using rspec. I have controllers that inherit from an admin controller. If I modify them to inherit from applicationcontroller the rspec test works. If I inherit from admincontroller i get "" back for a new template. Is there something I am missing to get this to work? The program works when running on the server. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110511/c95354c6/attachment.html>
I have this in my admin controller: before_filter :login_required before_filter :admin_required def admin_required current_user.is_admin? end -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110512/31f971a2/attachment.html>
On May 11, 2011, at 4:10 PM, Chris Habgood wrote:> I just started using rspec. I have controllers that inherit from an admin controller. If I modify them to inherit from applicationcontroller the rspec test works. If I inherit from admincontroller i get "" back for a new template. Is there something I am missing to get this to work? The program works when running on the server.Views are stubbed by default in controller specs [1], so you should always get an empty string back unless you tell RSpec to render views [2]. [1] http://relishapp.com/rspec/rspec-rails/dir/controller-specs/views-are-stubbed-by-default. [2] http://relishapp.com/rspec/rspec-rails/dir/controller-specs/render-views HTH, David
On Thu, May 12, 2011 at 10:32 AM, Chris Habgood <chabgood at gmail.com> wrote:> I have this in my admin controller: > > before_filter :login_required > before_filter :admin_required > > def admin_required > current_user.is_admin? > end > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersHi, can you please paste the controller and controller spec? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110517/c5d4b829/attachment.html>
On Tue, May 17, 2011 at 11:18 PM, Justin Ko <jko170 at gmail.com> wrote:> > > On Thu, May 12, 2011 at 10:32 AM, Chris Habgood <chabgood at gmail.com>wrote: > >> I have this in my admin controller: >> >> before_filter :login_required >> before_filter :admin_required >> >> def admin_required >> current_user.is_admin? >> end >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > Hi, can you please paste the controller and controller spec? > >Also, what versions of Ruby, RSpec, and Rails are you using? P.S. Welcome to RSpec! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110517/f6f9cb73/attachment-0001.html>