Guard is a command line tool that watches a file structure and automates events when changes are made in those files. While Guard has many uses, this article explores how we can use RSpec and Guard together to automate tests.
Once you have RSpec setup in your Rails project, you're ready to add Guard.
Add guard-rspec to the Gemfile
group :development, :test do gem 'rspec-rails' # These are set up from installing RSpec and Capybara gem 'capybara' gem 'guard-rspec' end
Add other :test group gems
group :test do gem 'rb-fsevent' gem 'growl' end
guard init spec
`bundle exec guard`