File: fix-commandline-test.patch

package info (click to toggle)
ruby-rspec-core 2.14.7-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,756 kB
  • ctags: 1,195
  • sloc: ruby: 12,708; makefile: 14
file content (33 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download | duplicates (2)
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