Posts

Showing posts from March, 2022

Setup Rspec

 1 install following Gems       group :development, :test do          # Use for test application        gem 'rspec-rails', '~> 5.0.2'        # Use for fixtures        gem 'factory_bot_rails', '~> 5.2.0'        # For create fake data        gem 'faker', '~> 2.19.0'        # use assigns in controller rspec        gem 'rails-controller-testing'   end             bundle install       rails generate rspec:install       bundle exec rspec           2 Format Spec output on console      add below line in  spec/.rspec file (create new file .rspec)       --format documentation            3 Modal Test cases       rails g rspec:model user            4 controller Test cases      rails g rspec:controller users                   5 Use simplecov gem for check test case coverage code      https://github.com/colszowka/simplecov       OR       type following command       rails stats           6  factory_bot_rails       this gem is used for