Re: [rspec-users] [Rails] Controller testing problem

2009-07-07 Thread Zach Moazeni
Bleh, I forgot to mention, if you have to maintain controller action code that is dependent on instance variables set elsewhere, here is a ruby hack that will allow you to setup the context. (Please note, I recommend refactoring the code under test but I understand sometimes the precondit

Re: [rspec-users] [Rails] Controller testing problem

2009-07-07 Thread Zach Moazeni
Hey Ignacy, I think I'm in the minority on this one, but I tend to keep my action logic independent of filters. Doing that, my typical controller spec begins like this: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require File.expand_path(File.dirname(__FILE__) + '/.

Re: [rspec-users] [Rails] Controller testing problem

2009-07-01 Thread Matt Wynne
On 1 Jul 2009, at 12:48, Fernando Perez wrote: Is there a way for RSpec to skip the filters in tests? Or to stop ApplicationController to derive from SiteController? That's a perfect use case for mocks and/or stubs. Indeed. Another way to do this is to test a special subclass of SiteContro

Re: [rspec-users] [Rails] Controller testing problem

2009-07-01 Thread Fernando Perez
> Is there a way for RSpec to skip the filters in tests? Or to stop > ApplicationController to derive from SiteController? That's a perfect use case for mocks and/or stubs. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-user

[rspec-users] [Rails] Controller testing problem

2009-07-01 Thread Ignacy Moryc
Hi, I'm working on a legacy app - it was created in 1.2.5 then over time ported to 2.3. It has absolutely no tests - and I'm trying to fix that in between adding new functionality. My problem right now is that my ApplicationController is running before_filters for setting different request variab