Tag Archives: rspec

How to Skip Filters in Controller RSpec Tests

I ran into an interesting dilemma today with a controller spec.

I needed to verify that a post to my controller’s update method did indeed update a particular setting on an instance of one of my models. Unfortunately, the controller I was using inherited some before_filter(s) from its parent that called a method that checked for a logged in user.

But all I wanted was to make sure my model’s setting actually got changed!

Continue reading

Advertisements
Tagged , , ,

Using RSpec in Rails

As a ruby on rails developer, I’d like to promote the need for testing your applications. No matter how small or large your project, tests will be an invaluable tool to ensure working functionality as you add, delete and refactor code. And I can promise you, during the lifespan of your web app, your code will remain far from static. This is very obvious when you are working for a client. They change their minds constantly. But even if YOU are the client, as I have found myself to be as I work on my own, hobby rails sites, I’ve discovered that even I cannot resist the urge to make changes to my site, some that often break past functionality.

Continue reading

Tagged ,
Advertisements