RSpec: automated testing and then manual testing. It works!
Posted on January 22, 2008
Filed Under development, ruby, testing | 2 Comments
I think I have caught the Ruby bug (always last to the party cleve, always the last to arrive!) in a big way. In between my day job, I have been reading (Programming Ruby, Agile Web Development with Rails, Everyday Scripting with Ruby) and writing (currently re-writing clevegibbon.com) Ruby. However, today I was seriously impressed with RSpec.
RSpec has come on some over the last few months. Armed with RSpec, today was the first time I’ve completely writing a bunch of new features for a web site, without once using the site directly. Let me put it another way, I didn’t fire up my browser once when developing the new features. It was all done via RSpec and Rails built-in support for functional/integration testing. And when I was happy that I had spec’d out the features and all the examples were passing, I fired up the browser, traversed to the site and hey presto, it worked as specified. I had to really shake myself, because I was preparing myself for a troubleshooting and/or debug session. I was simply not ready for it working as specified. So I now have time to write this blog entry…
Oh, before you go, here is the rspec for my Rails controllers for my new features (there are also some for the models, views and helpers). You can probably work out what I’m doing by just reading it. Nice!
AdminController for authorised users
- should have access to secured pages
AdminController for unauthorised Users
- should be re-directed to the login page
HomeController for all users
- should allow anonymous users access
InprogressController for authorised users
- should have access to secured pages
InprogressController for unauthorised users
- should be re-directed to the login page
LoginController for anonymous users
- should log in a known user and send them to the admin page
- should not permit unknown users to login in
LoginController for authorised users
- should log them out and direct them to the home page
- should log out users who attempt to login with a GET request
RubyController for all users
- should allow anonymous users access
StuffController for all users
- should allow anonymous users access
Finished in 0.260431 seconds
11 examples, 0 failures
Comments
2 Responses to “RSpec: automated testing and then manual testing. It works!”


Nice! What tools are you using in conjunction with rSpec?
Hey Merlyn,
I’m using all the stuff out the Rails and rSpec box. No other tools except the essentials, TextMate, rake and webrick as the server. But I have to admit, there was a lot to take in just to do this from someone who is new to Ruby. I think the learning curve is quite steep. But then again, I love climbing
I see from your blog that you continue to tinker with Ruby as well?
PS: I like Buildr too!