rails swtiching to rspec from default test unit -


i have rails 4 app. have no tests @ moment, when created app didn't skip default test unit there empty test files (and other default settings) in app.

now use rspec + capybara, don't know necessary steps install , make sure testing work fine. saw answers on stackoverflow thoose pretty old.

as far know installation looks if test unit skipped on creation:

group :development, :test   gem 'rspec-rails' end  group :test   gem 'capybara' end 

then

rails g rspec:install 

can sby tell me steps are?

follow these steps:

add code your_app/config/application.rb file:

config.generators |g|   g.test_framework :rspec end 

add below code your_app's gemfile:

group :test, :development   gem 'rspec-rails' end 

save it, , run bundle install install rspec gem

initialize spec/ directory

rails generate rspec:install 

use rspec command run specs:

bundle exec rspec 

hopefully helps.


Comments