2013-01-11

Entries

Spent a good part of the day with RSpec today

#

First was writing a spec for a bug I fixed yesterday. Wrong order, I know, but often I know how to fix the problem before I know how to write the spec for it.

#

Then the issue I had was that I wasn't setting up the right scenario for my spec to fail before putting the working code back in.

#

Struggled with getting JSON view specs working but gave up on that for now. View spec was telling me no route matches.

#

Lastly I had a lot of set up code in order to test something as an "Admin" user and users with varying abilities/rights in general.

#

I'm using CanCan to handle authorization and found this excellent technique for mocking up abilities without having to generate a bunch of users, roles and rights (how pemissions work in the system) - Testing views that use CanCan and Devise with RSpec

#

This is also explained on CanCan's Testing Abilities wiki page but I can't link to the Controller Testing section where it's described.

#

I always find myself not using and deleting the CSS and JS files generated by Rails generat scaffold command, so it's time to disable that.

#

Rails scaffold without the css file?

#

And more details in the official docs 3.3 Configuring Generators

#

Comments

comments powered by Disqus