Skip to content

Make specs and features global configuration proof

Created by: pirj

If a ~/.config/rspec/options file contains the following:

--color
--profile 2
--format progress
--require pry

some specs and features fail, since they are run with options that contradict the default ones, and expectations are not met.

Example failures:

 (RSpec::Expectations::ExpectationNotMetError)
features/verifying_doubles/partial_doubles.feature:34:in `Then the output should contain "1 example, 1 failure"'
...
LoadError:
  cannot load such file -- pry


6) RSpec::Core::Formatters::ProgressFormatter produces the expected full output
...
   +Top 2 slowest example groups:
   +  pending command with block format
   +    n.nnnn seconds average (n.nnnn seconds / 2 examples) ./spec/rspec/core/resources/formatter_specs.rb:14
   +  failing spec
   +    n.nnnn seconds average (n.nnnn seconds / 2 examples) ./spec/rspec/core/resources/formatter_specs.rb:35
   +

This fixes https://github.com/rspec/rspec-dev/issues/217. Similar issues affect features of rspec-mocks and rspec-expectations, will send out pull requests shortly.

NOTE: Unfortunately, this doesn't fix the issue for configuration stored in ~/.rspec. My advice is to move it over to ~/.config/rspec/options.

NOTE: Unfortunately, this doesn't fix the issue for --require pry for features.

Merge request reports