RSpec for Ruby on Rails

At this time we need all thing automation. It’s Good for user/company they no need to test code it will be tested automatically and RSpec test cases for ruby on rails used for the same.

RSpec is a unit test case framework for Ruby language. We also consider RSpec as a tool for Ruby. RSpec was created for behavior-driven development (BDD) which means it’s a focus on behaviors of application for testing.

It makes writing tests simpler, more expressive, and easier to maintain!

Install RSpec in Ruby Application

echo 'gem "rspec-rails", :group => [:development, :test]' >> Gemfile

Your GemFile look like this:

group :development, :test do
  gem 'rspec-rails', '~> 3.4'

Bundle installs for install RSpec Gem into your application.

Bundle install

Now run RSpec for adds the spec directory and some skeleton files, including a .rspec file. 

rails generate rspec:install
Convert Object to hash