File: 0001-spec_helper-fix-running-tests-on-Debian.patch

package info (click to toggle)
ruby-foreman 0.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 584 kB
  • sloc: ruby: 2,020; sh: 88; makefile: 8
file content (51 lines) | stat: -rw-r--r-- 1,460 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: Antonio Terceiro <terceiro@softwarelivre.org>
Date: Wed, 4 Feb 2015 11:31:10 -0200
Subject: spec_helper: fix running tests on Debian

Fixes running tests against installed package, and also against
different Ruby interpreters.

Forwarded: not-needed
---
 spec/spec_helper.rb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 87e6889..9110e82 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -9,7 +9,9 @@ require "pp"
 require "fakefs/safe"
 require "fakefs/spec_helpers"
 
-$:.unshift File.expand_path("../../lib", __FILE__)
+unless ENV['AUTOPKGTEST_TMP']
+  ENV['PATH'] = 'bin:' + ENV['PATH']
+end
 
 def mock_export_error(message)
   expect { yield }.to raise_error(Foreman::Export::Exception, message)
@@ -35,9 +37,13 @@ def foreman(args)
   end
 end
 
+def ruby
+  RbConfig::CONFIG['RUBY_INSTALL_NAME']
+end
+
 def forked_foreman(args)
   rd, wr = make_pipe
-  Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
+  Process.spawn("#{ruby} -S foreman #{args}", :out => wr, :err => wr)
   wr.close
   rd.read
 end
@@ -62,7 +68,7 @@ def fork_and_capture(&blk)
 end
 
 def fork_and_get_exitstatus(args)
-  pid = Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
+  pid = Process.spawn("#{ruby} -S foreman #{args}", :out => "/dev/null", :err => "/dev/null")
   Process.wait(pid)
   $?.exitstatus
 end