torquespec 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/torquespec/daemon.rb +14 -11
- data/lib/torquespec/torquespec.rb +7 -13
- data/lib/torquespec/version.rb +1 -1
- data/spec/remote_spec.rb +2 -1
- metadata +4 -4
data/lib/torquespec/daemon.rb
CHANGED
@@ -6,19 +6,22 @@ module TorqueSpec
|
|
6
6
|
class Daemon
|
7
7
|
|
8
8
|
def initialize(opts={})
|
9
|
-
puts "JC: create daemon opts=#{opts}"
|
10
|
-
|
9
|
+
puts "JC: create daemon opts=#{opts.inspect}"
|
10
|
+
dir = opts['pwd'].to_s
|
11
|
+
raise "The 'pwd' option must contain a valid directory name" unless dir.any? && File.exist?(dir)
|
12
|
+
Dir.chdir( dir ) do
|
13
|
+
RSpec::Core::Runner.disable_autorun! # avoid a bunch of at_exit finalizer errors
|
14
|
+
@options = RSpec::Core::ConfigurationOptions.new( opts['argv'].to_a )
|
15
|
+
@options.parse_options
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
@configuration = RSpec::configuration
|
18
|
+
@world = RSpec::world
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@configuration.configure_mock_framework
|
21
|
-
@configuration.configure_expectation_framework
|
20
|
+
@options.configure(@configuration)
|
21
|
+
@configuration.load_spec_files
|
22
|
+
@configuration.configure_mock_framework
|
23
|
+
@configuration.configure_expectation_framework
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
def start
|
@@ -30,22 +30,16 @@ module TorqueSpec
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# A somewhat hackish way of exposing client-side gems to the server-side daemon
|
33
|
-
#
|
34
|
-
# TODO: Fix it so I don't include old versions of TorqueSpec
|
35
|
-
#
|
36
33
|
def self.rubylib
|
37
|
-
|
34
|
+
here = File.dirname(__FILE__)
|
35
|
+
rspec_libs = Dir.glob(File.expand_path(File.join(here, "../../..", "*{rspec,diff-lcs}*/lib")))
|
36
|
+
this_lib = File.expand_path(File.join(here, ".."))
|
37
|
+
rspec_libs.unshift( this_lib ).join(":")
|
38
38
|
end
|
39
39
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
# and we can't just map its items to their expanded path, e.g. -l
|
44
|
-
# 42, so we must pass (ARGV || spec) and Dir.pwd so that the daemon
|
45
|
-
# may initialize itself within that directory.
|
46
|
-
#
|
47
|
-
def self.specs
|
48
|
-
RSpec::configuration.files_to_run.map {|f| File.expand_path(f) }.inspect
|
40
|
+
# We must initialize the daemon with the same params as passed to the client
|
41
|
+
def self.argv
|
42
|
+
( ARGV.empty? ? [ 'spec' ] : ARGV ).inspect
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
data/lib/torquespec/version.rb
CHANGED
data/spec/remote_spec.rb
CHANGED
@@ -7,7 +7,8 @@ remote_describe "in-container tests" do
|
|
7
7
|
root: #{File.dirname(__FILE__)}/../apps/simple
|
8
8
|
services:
|
9
9
|
TorqueSpec::Daemon:
|
10
|
-
argv: #{
|
10
|
+
argv: #{TorqueSpec.argv}
|
11
|
+
pwd: #{Dir.pwd}
|
11
12
|
environment:
|
12
13
|
RUBYLIB: #{TorqueSpec.rubylib}
|
13
14
|
END
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Crossley
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06-
|
19
|
+
date: 2011-06-09 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|