« back to all cards in this deck
Posted about 3 years ago. Visible to the public.

A nicer way to run RSpec and/or Cucumber

geordi, our collection of awesome shell scripts, has been extended by three scripts to help you call RSpec or Cucumber:

cuc

This script runs Cucumber the way you want it:

  • Prints some line feeds to easily find your test results when you come back to the console later
  • Configures Cucumber to use cucumber_spinner if it is available in your Gemfile
  • Runs Cucumber under bundle exec
  • Uses an old version of Firefox for Selenium (Javascript) features if you setup your system that way
  • Runs features in parallel if parallel_tests gem was found in you Gemfile and no rerun.txt with content exists
  • [UPDATE] You can pass all cucumber command line options to the cuc script even if the tests are executed with parallel_tests.

Example usage:

cuc # runs all features cuc features/users.feature # only run one feature cuc -f pretty -t wip features/users.feature # run one feature with parameters like cucumber

rs

This script runs RSpec the way you want it:

  • Prints some line feeds to easily find your test results when you come back to the console later
  • Calls RSpec 1 (spec) in a Rails 2 project and RSpec 2 (rspec) in a Rails 3 project
  • Configures RSpec to use rspec_spinner if it is available in your Gemfile
  • If rspec_spinner is unavailable, switches on color output
  • Runs all examples in spec if you don't give an argument
  • Runs RSpec under bundle exec
  • Runs examples in parallel if parallel_tests gem was found in you Gemfile

Example usage:

rs # runs all examples rs spec/models/user_spec.rb # only runs one example

tests

This runs all your tests for a full check against regressions:

  • Deletes a rerun.txt from earlier Cucumber failures
  • Runs rs
  • Runs cuc if rs succeeds

You can install all the scripts in the geordi toolbox by saying

gem install geordi
Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Author of this card:

Avatar
Henning Koch
Keywords:
better
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code

License for source code

All source code included in the card A nicer way to run RSpec and/or Cucumber is licensed under the license stated below. This includes both code snippets embedded in the card text and code that is included as a file attachment. Excepted from this license are code snippets that are explicitely marked as citations from another source.

The MIT License (MIT)

Copyright (c) 2011-2013 makandra GmbH

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
Posted by Henning Koch to makandropedia