Forum: RSpec Disabling database access in controller specs

Posted by Stefan Kanev (Guest)
on 2010-03-03 21:57
(Received via mailing list)
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
Posted by Matt Wynne (mattwynne)
on 2010-03-04 00:01
(Received via mailing list)
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:

> Thanks,
> Stefan
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

cheers,
Matt

http://mattwynne.net
+447974 430184
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.