1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Description: Fix 'CommandLine configures streams before command line options' when no .rspec exists
Author: Jérémy Bobbio <lunar@debian.org>
Last-Update: 2013-03-26
When running the specs from an unpacked gem, there is no `.rspec` available, which
means that `config.force` never gets called and the "Commandline configures
streams before command line options" test fails.
So instead of relying on a file that is not always present, we temporarily pass
a 'forced' option through an environment variable.
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/spec/rspec/core/command_line_spec.rb
+++ b/spec/rspec/core/command_line_spec.rb
@@ -15,6 +15,9 @@ module RSpec::Core
it "configures streams before command line options" do
config.stub :load_spec_files
+ old_env = ENV['SPEC_OPTS']
+ ENV['SPEC_OPTS'] = '--default_path spec'
+
# this is necessary to ensure that color works correctly on windows
config.should_receive(:error_stream=).ordered
config.should_receive(:output_stream=).ordered
@@ -22,6 +25,8 @@ module RSpec::Core
command_line = build_command_line
command_line.run err, out
+
+ ENV['SPEC_OPTS'] = old_env
end
it "assigns ConfigurationOptions built from Array of options to @options" do
|