Tag Archives: rspec

Ruby connection pooling made easy

If you ever want to have a connection pool, you need not reinvent the wheel because Mike Perham has done all the work for you already. Browse on over to connection_pool on github. Advertisements

Posted in Uncategorized | Tagged , | Leave a comment

Write your own custom RSpec formatter

Earlier this year I spent some time writing a custom RSpec formatter. The purpose in my case was to be able to automatically update a remote service with the results of testing some code. You can find that project here, … Continue reading

Posted in Uncategorized | Tagged , , | 2 Comments

Ruby’s Singleton and Custom Rails Application Configuration

A relatively simple way to load some configuration once and safely, is through the use of the Singleton module provided with Ruby. Accessing the instance is easy, call FooConfig.instance. This method is also thread-safe so no two threads are going … Continue reading

Posted in rails | Tagged , , , | 1 Comment

Rails + Kaminari with RSpec

The default rspec view specs don’t work so well for index pages if you have added Kaminari pagination. The reason is the assigned variable in the controller is not an array, but is instead expected to respond to additional methods: … Continue reading

Posted in rails | Tagged , | Leave a comment

Rails + Devise and Rspec

So I tried using Devise on a project and ran into an issue with the default generated controller specs. PlansController POST create with invalid params re-renders the ‘new’ template Failure/Error: response.should render_template(“new”) expecting <“new”> but rendering with <“”> # ./plans_controller_spec.rb:73:in … Continue reading

Posted in rails | Tagged , | 1 Comment