In this article I will cover how to use cucumber and Factory Girl to write Stories in Rails.
TDD(Test Driven Development) is the most powerful and most approachable concept in most of the programming language. When it comes to rails, it provides a convenient and simplest way to writeUnit test cases and the stories for your controller, without writing complex lines of code.
Let’s see how you can cover the test coverage for your rails application.
IMPORTANT: The concept behind using cucumber, so that we can write the ‘stories’, which will tell us how our controller’s method behaves when its called.
To get started, install the cucumber gem on your machine by typing:
gem install cucumber
and you’ll find progress like this:
<images comes here />
Next, you need to install rspec and rspec-rails. To do that type:
gem install rspec
gem install rspec-rails