Find file History
Latest commit 350bbab Sep 1, 2016 @CodingItWrong CodingItWrong Add force_color and no_color options
Adds a --force-color option to always enable color, regardless of the TTY settings. Also changes the implementation of --no-color to ensure it continues to always disable color, including disabling it if --force-color enabled it.

The --color flag is marked as deprecated but its behavior stays the same: it still enables color _only_ when the output is a TTY or when the --tty flag is passed.

In the past, --color and --no-color were both allowed to be passed, and the last one passed would override the previous ones. For the new --force-color flag, we abort the program if both it and --no-color is passed, to require the user to specify a single flag to be clearer.

The default behavior when no flags are passed has changed: by default, color will be enabled iff the output is a TTY. The --tty flag is not considered; using --force-color and --no-color is a simpler and more predictable way to override the default.

The implementation of these two flags in configuration.rb involves a single @color_mode property with three possible settings: :automatic by default, :on if --force-color is set, :off if --no-color is set. The previous @color property is retained to track the deprecated --color flag.

README.md

rspec-core provides the structure for RSpec code examples:

describe Account do
  it "has a balance of zero when first opened" do
    # example code goes here - for more on the
    # code inside the examples, see rspec-expectations
    # and rspec-mocks
  end
end

Issues

This documentation is open source, and a work in progress. If you find it incomplete or confusing, please submit an issue, or, better yet, a pull request.