Stefan Kanev
2010-Mar-03 20:43 UTC
[rspec-users] Disabling database access in controller specs
It took a while, but now I an totally convinced that controller specs should not access the database and stub as much as possible. I''m committed to that style of writing, yet from time to time I incidentally allow it to happen. Is there a way to err on the safe side and have RSpec throw an error every time a controller spec attempts to access the database? And does it sound like a good idea? Thanks, Stefan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100303/679ae0fe/attachment-0001.html>
Matt Wynne
2010-Mar-03 22:54 UTC
[rspec-users] Disabling database access in controller specs
You could use something like NullDb to achieve this, I think: http://www.slideshare.net/bmabey/disconnecting-the-database-with-activerecord On 3 Mar 2010, at 20:43, Stefan Kanev wrote:> It took a while, but now I an totally convinced that controller > specs should not access the database and stub as much as possible. > I''m committed to that style of writing, yet from time to time I > incidentally allow it to happen. > > Is there a way to err on the safe side and have RSpec throw an error > every time a controller spec attempts to access the database? > > And does it sound like a good idea? > > Thanks, > Stefan > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-userscheers, Matt http://mattwynne.net +447974 430184