Posts Tagged ‘Rspec’

Developer’s journal: devise, Rails 3, RSpec, and more

Friday, July 9th, 2010

I keep a text file open as I work, and when I learn something, or fix a bug, I make a note of that in the text file. I call it my journal. It’s pretty low-tech, but text search turns out to be a sufficient way to look up past experiences when I find myself thinking “this problem seems so familiar”. There’s another benefit too: I find keeping simple notes about what I’m doing—what problems I’m solving, what approaches I’m using, what’s working and what could work better—keeps me focused on my goals. It turns out learning a programming language or a web framework is not as hard as training your mind to solve programming challenges efficiently.

Here are some things from my journal: I’m working on a Rails 3 app right now, something I plan to flog and promote mercilessly in upcoming posts. I’ve encountered some mysteries for which there was no simple HOWTO information easily available via web search. I thought I’d share the answers I cobbled together:

  1. How to get RSpec and RSpec-Rails for Rails 3;
  2. How to make devise routing work with related nested routes;
  3. How to spec controllers that use devise to restrict access to logged-in users;
  4. How to get verify :method to work in Rails 3.

(more…)

Love/Hate: RSpec

Tuesday, July 8th, 2008

I decided a couple of months ago that my haphazard unit testing practices were not covering enough of my Rails projects’ code. It’s easy, when you’re the only developer on a project, to get pretty lazy about a lot of things, and testing is one of them. See, I believe firmly in testing. Untested code is unreliable code. I wanted to be more rigorous. So I decided to use RSpec. I’d been poking around it for a while, but I decided to commit and dive in. It has been a rocky road. Read on for my Pro-and-Con review of programming with RSpec.

(more…)