Tag Archives: RSpec

Rails – Devise User Sign In for RSpec

Last time we should you how to create the mock user using the Factory Girl ♥ Rails gem.
Rails – Create Mock Data for RSpec

Recalled that spec file. Continue reading Rails – Devise User Sign In for RSpec

Rails – Create Mock Data for RSpec

When running the test cases, most likely we need some mock data to test the functionality of our code. The factory_girl_rails gem is useful for creating mock data for testing purpose. Continue reading Rails – Create Mock Data for RSpec

Rails – RSpec Test with Devise

According to the documentation in the Devise home page, we can use the following before_filter to control the user access on specific controller functions.

before_filter :authenticate_user!

 

But when i try to test the controller function in RSpec, i got the following error.
Failure/Error: post :create
undefined method `authenticate!’ for nil:NilClass
Continue reading Rails – RSpec Test with Devise

Rails – Running RSpec with Spork Test Server

I am still continuing the tutorial @ Ruby on Rails Tutorial by Michael Hartl

Last time we have integrated the RSpec and Autotest in Rails 3.
Rails – Integrate Autotest and RSpec in Linux
 

But it seems that it takes quite long for RSpec to complete the tests. This is because RSpec reloads the entire Rails environment for each run. Spork Test Server helps you preloading the Rails environment which greatly reduces the time for running the test suite.

1. Add the spork gem in the Gemfile Continue reading Rails – Running RSpec with Spork Test Server

Rails – Integrate Autotest and RSpec in Linux

I am learning Rails 3 @ Ruby on Rails Tutorial by Michael Hartl. A very nice and detail tutorial with many examples for beginners. Highly recommended.

But i got some problems when i tried to setup the Autotest for the RSpec framework. Autotest is a continuous testing tool which run the test suite automatically based on the files you have changed. RSpec is a Behavior Driven Development (BDD) framework for Ruby. After a few hours of struggling, i finally made it work.

1. Create a new Rails project without the default Test::Unit framework.

  • rails new sample_app -T

Continue reading Rails – Integrate Autotest and RSpec in Linux