specjour 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +12 -1
- data/README.markdown +19 -5
- data/Rakefile +3 -35
- data/lib/specjour/cucumber/preloader.rb +0 -22
- data/lib/specjour/cucumber/runner.rb +5 -9
- data/lib/specjour/cucumber.rb +0 -1
- data/lib/specjour/db_scrub.rb +15 -10
- data/lib/specjour/printer.rb +1 -1
- data/lib/specjour/rspec/distributed_formatter.rb +32 -56
- data/lib/specjour/rspec/final_report.rb +60 -52
- data/lib/specjour/rspec/marshalable_exception.rb +1 -1
- data/lib/specjour/rspec/preloader.rb +1 -1
- data/lib/specjour/rspec/runner.rb +9 -8
- data/lib/specjour/{rspec2 → rspec}/shared_example_group_ext.rb +1 -1
- data/lib/specjour/rspec.rb +10 -29
- data/lib/specjour/socket_helper.rb +2 -0
- data/lib/specjour/worker.rb +2 -2
- data/lib/specjour.rb +3 -3
- metadata +24 -112
- data/.dev +0 -3
- data/.document +0 -5
- data/.gitignore +0 -25
- data/.rvmrc +0 -1
- data/Gemfile +0 -2
- data/VERSION +0 -1
- data/lib/specjour/rspec/marshalable_rspec_failure.rb +0 -21
- data/lib/specjour/rspec2/distributed_formatter.rb +0 -48
- data/lib/specjour/rspec2/final_report.rb +0 -73
- data/lib/specjour/rspec2/runner.rb +0 -12
- data/sample/features/fail.feature +0 -31
- data/sample/features/pass.feature +0 -31
- data/sample/features/step_definitions/sample_steps.rb +0 -26
- data/sample/features/undefined.feature +0 -17
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -20
- data/spec/specjour/cli_spec.rb +0 -105
- data/spec/specjour/configuration_spec.rb +0 -112
- data/spec/specjour/cpu_spec.rb +0 -28
- data/spec/specjour/manager_spec.rb +0 -21
- data/spec/specjour/printer_spec.rb +0 -101
- data/spec/specjour/rsync_daemon_spec.rb +0 -90
- data/spec/specjour_spec.rb +0 -18
- data/specjour.gemspec +0 -125
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 1
|
10
|
-
version: 0.3.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.0
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Sandro Turriate
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-03-09 00:00:00 -08:00
|
19
14
|
default_executable: specjour
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - "="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 19
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 3
|
33
|
-
- 4
|
34
24
|
version: 1.3.4
|
35
25
|
type: :runtime
|
36
26
|
version_requirements: *id001
|
@@ -42,11 +32,6 @@ dependencies:
|
|
42
32
|
requirements:
|
43
33
|
- - ">="
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 39
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 14
|
49
|
-
- 0
|
50
35
|
version: 0.14.0
|
51
36
|
type: :runtime
|
52
37
|
version_requirements: *id002
|
@@ -56,14 +41,9 @@ dependencies:
|
|
56
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
42
|
none: false
|
58
43
|
requirements:
|
59
|
-
- - "
|
44
|
+
- - ">="
|
60
45
|
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 3
|
65
|
-
- 0
|
66
|
-
version: 1.3.0
|
46
|
+
version: 2.5.0
|
67
47
|
type: :development
|
68
48
|
version_requirements: *id003
|
69
49
|
- !ruby/object:Gem::Dependency
|
@@ -74,11 +54,6 @@ dependencies:
|
|
74
54
|
requirements:
|
75
55
|
- - ">="
|
76
56
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 33
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
- 10
|
81
|
-
- 11
|
82
57
|
version: 0.10.11
|
83
58
|
type: :development
|
84
59
|
version_requirements: *id004
|
@@ -90,11 +65,6 @@ dependencies:
|
|
90
65
|
requirements:
|
91
66
|
- - ">="
|
92
67
|
- !ruby/object:Gem::Version
|
93
|
-
hash: 59
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
- 9
|
97
|
-
- 0
|
98
68
|
version: 0.9.0
|
99
69
|
type: :development
|
100
70
|
version_requirements: *id005
|
@@ -106,102 +76,57 @@ dependencies:
|
|
106
76
|
requirements:
|
107
77
|
- - ">="
|
108
78
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 13
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
- 5
|
113
|
-
- 3
|
114
79
|
version: 0.5.3
|
115
80
|
type: :development
|
116
81
|
version_requirements: *id006
|
117
|
-
-
|
118
|
-
name: jeweler
|
119
|
-
prerelease: false
|
120
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
hash: 7
|
126
|
-
segments:
|
127
|
-
- 1
|
128
|
-
- 4
|
129
|
-
- 0
|
130
|
-
version: 1.4.0
|
131
|
-
type: :development
|
132
|
-
version_requirements: *id007
|
133
|
-
description: Distribute your spec suite amongst your LAN via Bonjour.
|
82
|
+
description: " Specjour splits your RSpec suite across multiple machines, and multiple\n cores per machine, to run super-parallel-fast! Also works with Cucumber.\n"
|
134
83
|
email: sandro.turriate@gmail.com
|
135
84
|
executables:
|
136
85
|
- specjour
|
137
86
|
extensions: []
|
138
87
|
|
139
|
-
extra_rdoc_files:
|
140
|
-
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
141
90
|
files:
|
142
|
-
- .dev
|
143
|
-
- .document
|
144
|
-
- .gitignore
|
145
|
-
- .rvmrc
|
146
|
-
- Gemfile
|
147
|
-
- History.markdown
|
148
|
-
- MIT_LICENSE
|
149
|
-
- README.markdown
|
150
|
-
- Rakefile
|
151
|
-
- VERSION
|
152
|
-
- bin/specjour
|
153
|
-
- lib/specjour.rb
|
154
91
|
- lib/specjour/cli.rb
|
155
92
|
- lib/specjour/configuration.rb
|
156
93
|
- lib/specjour/connection.rb
|
157
94
|
- lib/specjour/cpu.rb
|
158
|
-
- lib/specjour/cucumber.rb
|
159
95
|
- lib/specjour/cucumber/distributed_formatter.rb
|
160
96
|
- lib/specjour/cucumber/final_report.rb
|
161
97
|
- lib/specjour/cucumber/main_ext.rb
|
162
98
|
- lib/specjour/cucumber/preloader.rb
|
163
99
|
- lib/specjour/cucumber/runner.rb
|
100
|
+
- lib/specjour/cucumber.rb
|
164
101
|
- lib/specjour/db_scrub.rb
|
165
102
|
- lib/specjour/dispatcher.rb
|
166
103
|
- lib/specjour/manager.rb
|
167
104
|
- lib/specjour/printer.rb
|
168
105
|
- lib/specjour/protocol.rb
|
169
106
|
- lib/specjour/quiet_fork.rb
|
170
|
-
- lib/specjour/rspec.rb
|
171
107
|
- lib/specjour/rspec/distributed_formatter.rb
|
172
108
|
- lib/specjour/rspec/final_report.rb
|
173
109
|
- lib/specjour/rspec/marshalable_exception.rb
|
174
|
-
- lib/specjour/rspec/marshalable_rspec_failure.rb
|
175
110
|
- lib/specjour/rspec/preloader.rb
|
176
111
|
- lib/specjour/rspec/runner.rb
|
177
|
-
- lib/specjour/
|
178
|
-
- lib/specjour/
|
179
|
-
- lib/specjour/rspec2/runner.rb
|
180
|
-
- lib/specjour/rspec2/shared_example_group_ext.rb
|
112
|
+
- lib/specjour/rspec/shared_example_group_ext.rb
|
113
|
+
- lib/specjour/rspec.rb
|
181
114
|
- lib/specjour/rsync_daemon.rb
|
182
115
|
- lib/specjour/socket_helper.rb
|
183
116
|
- lib/specjour/worker.rb
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
- spec/specjour/cli_spec.rb
|
191
|
-
- spec/specjour/configuration_spec.rb
|
192
|
-
- spec/specjour/cpu_spec.rb
|
193
|
-
- spec/specjour/manager_spec.rb
|
194
|
-
- spec/specjour/printer_spec.rb
|
195
|
-
- spec/specjour/rsync_daemon_spec.rb
|
196
|
-
- spec/specjour_spec.rb
|
197
|
-
- specjour.gemspec
|
117
|
+
- lib/specjour.rb
|
118
|
+
- MIT_LICENSE
|
119
|
+
- README.markdown
|
120
|
+
- History.markdown
|
121
|
+
- Rakefile
|
122
|
+
- bin/specjour
|
198
123
|
has_rdoc: true
|
199
|
-
homepage:
|
124
|
+
homepage: https://github.com/sandro/specjour
|
200
125
|
licenses: []
|
201
126
|
|
202
127
|
post_install_message:
|
203
|
-
rdoc_options:
|
204
|
-
|
128
|
+
rdoc_options: []
|
129
|
+
|
205
130
|
require_paths:
|
206
131
|
- lib
|
207
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -209,32 +134,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
134
|
requirements:
|
210
135
|
- - ">="
|
211
136
|
- !ruby/object:Gem::Version
|
212
|
-
hash: 3
|
213
|
-
segments:
|
214
|
-
- 0
|
215
137
|
version: "0"
|
216
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
139
|
none: false
|
218
140
|
requirements:
|
219
141
|
- - ">="
|
220
142
|
- !ruby/object:Gem::Version
|
221
|
-
|
222
|
-
segments:
|
223
|
-
- 0
|
224
|
-
version: "0"
|
143
|
+
version: 1.3.6
|
225
144
|
requirements: []
|
226
145
|
|
227
146
|
rubyforge_project:
|
228
|
-
rubygems_version: 1.
|
147
|
+
rubygems_version: 1.6.0
|
229
148
|
signing_key:
|
230
149
|
specification_version: 3
|
231
150
|
summary: Distribute your spec suite amongst your LAN via Bonjour.
|
232
|
-
test_files:
|
233
|
-
|
234
|
-
- spec/specjour/cli_spec.rb
|
235
|
-
- spec/specjour/configuration_spec.rb
|
236
|
-
- spec/specjour/cpu_spec.rb
|
237
|
-
- spec/specjour/manager_spec.rb
|
238
|
-
- spec/specjour/printer_spec.rb
|
239
|
-
- spec/specjour/rsync_daemon_spec.rb
|
240
|
-
- spec/specjour_spec.rb
|
151
|
+
test_files: []
|
152
|
+
|
data/.dev
DELETED
data/.document
DELETED
data/.gitignore
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## PROJECT::SPECIFIC
|
22
|
-
.specjour
|
23
|
-
spec/spec.opts
|
24
|
-
.bundle
|
25
|
-
Gemfile.lock
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm gemset use specjour
|
data/Gemfile
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.1
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Specjour
|
2
|
-
module Rspec
|
3
|
-
class ::Spec::Runner::Reporter::Failure
|
4
|
-
|
5
|
-
def initialize(group_description, example_description, exception)
|
6
|
-
@example_name = "#{group_description} #{example_description}"
|
7
|
-
@exception = MarshalableException.new(exception)
|
8
|
-
@pending_fixed = exception.is_a?(Spec::Example::PendingExampleFixedError)
|
9
|
-
@exception_not_met = exception.is_a?(Spec::Expectations::ExpectationNotMetError)
|
10
|
-
end
|
11
|
-
|
12
|
-
def pending_fixed?
|
13
|
-
@pending_fixed
|
14
|
-
end
|
15
|
-
|
16
|
-
def expectation_not_met?
|
17
|
-
@exception_not_met
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Specjour::Rspec
|
2
|
-
class DistributedFormatter < ::RSpec::Core::Formatters::ProgressFormatter
|
3
|
-
|
4
|
-
def metadata_for_examples
|
5
|
-
examples.map do |example|
|
6
|
-
metadata = example.metadata
|
7
|
-
{
|
8
|
-
:execution_result => marshalable_execution_result(example.execution_result),
|
9
|
-
:description => metadata[:description],
|
10
|
-
:file_path => metadata[:file_path],
|
11
|
-
:full_description => metadata[:full_description],
|
12
|
-
:line_number => metadata[:line_number],
|
13
|
-
:location => metadata[:location]
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def noop(*args)
|
19
|
-
end
|
20
|
-
alias dump_pending noop
|
21
|
-
alias dump_failures noop
|
22
|
-
alias start_dump noop
|
23
|
-
alias message noop
|
24
|
-
|
25
|
-
def color_enabled?
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
def dump_summary(*args)
|
30
|
-
output.send_message :rspec_summary=, metadata_for_examples
|
31
|
-
end
|
32
|
-
|
33
|
-
def close
|
34
|
-
@examples = []
|
35
|
-
super
|
36
|
-
end
|
37
|
-
|
38
|
-
protected
|
39
|
-
|
40
|
-
def marshalable_execution_result(execution_result)
|
41
|
-
if exception = execution_result[:exception_encountered]
|
42
|
-
execution_result[:exception_encountered] = MarshalableException.new(exception)
|
43
|
-
end
|
44
|
-
execution_result
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
module Specjour::Rspec
|
2
|
-
class FinalReport
|
3
|
-
attr_reader :examples
|
4
|
-
attr_reader :duration
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@examples = []
|
8
|
-
@duration = 0.0
|
9
|
-
::Rspec.configuration.color_enabled = true
|
10
|
-
::Rspec.configuration.output_stream = $stdout
|
11
|
-
end
|
12
|
-
|
13
|
-
def add(data)
|
14
|
-
if data.respond_to?(:has_key?) && data.has_key?(:duration)
|
15
|
-
self.duration = data[:duration]
|
16
|
-
else
|
17
|
-
metadata_for_examples(data)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def duration=(value)
|
22
|
-
@duration = value.to_f if duration < value.to_f
|
23
|
-
end
|
24
|
-
|
25
|
-
def exit_status
|
26
|
-
formatter.failed_examples.empty?
|
27
|
-
end
|
28
|
-
|
29
|
-
def metadata_for_examples(metadata_collection)
|
30
|
-
examples.concat(
|
31
|
-
metadata_collection.map do |partial_metadata|
|
32
|
-
example = ::Rspec::Core::Example.allocate
|
33
|
-
example.instance_variable_set(:@example_group_class,
|
34
|
-
OpenStruct.new(:metadata => {}, :ancestors => [])
|
35
|
-
)
|
36
|
-
metadata = ::Rspec::Core::Metadata.new
|
37
|
-
metadata.merge! partial_metadata
|
38
|
-
example.instance_variable_set(:@metadata, metadata)
|
39
|
-
example
|
40
|
-
end
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
def pending_examples
|
45
|
-
::RSpec.world.find(examples, :execution_result => { :status => 'pending' })
|
46
|
-
end
|
47
|
-
|
48
|
-
def failed_examples
|
49
|
-
::RSpec.world.find(examples, :execution_result => { :status => 'failed' })
|
50
|
-
end
|
51
|
-
|
52
|
-
def formatter
|
53
|
-
@formatter ||= new_progress_formatter
|
54
|
-
end
|
55
|
-
|
56
|
-
def summarize
|
57
|
-
if examples.size > 0
|
58
|
-
formatter.start_dump
|
59
|
-
formatter.dump_pending
|
60
|
-
formatter.dump_failures
|
61
|
-
formatter.dump_summary(duration, examples.size, failed_examples.size, pending_examples.size)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
protected
|
66
|
-
def new_progress_formatter
|
67
|
-
new_formatter = ::Rspec::Core::Formatters::ProgressFormatter.new($stdout)
|
68
|
-
new_formatter.instance_variable_set(:@failed_examples, failed_examples)
|
69
|
-
new_formatter.instance_variable_set(:@pending_examples, pending_examples)
|
70
|
-
new_formatter
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Specjour::Rspec::Runner
|
2
|
-
def self.run(spec, output)
|
3
|
-
reset
|
4
|
-
args = ['--format=Specjour::Rspec::DistributedFormatter', spec]
|
5
|
-
::Rspec::Core::Runner.run_in_process args, $stderr, output
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.reset
|
9
|
-
::Rspec.world.instance_variable_set(:@example_groups, [])
|
10
|
-
::Rspec.configuration.instance_variable_set(:@formatter, nil)
|
11
|
-
end
|
12
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Feature: Failing sample
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given anything
|
5
|
-
|
6
|
-
Scenario: Winning
|
7
|
-
When I do something good
|
8
|
-
Then fail
|
9
|
-
|
10
|
-
Scenario: Losing
|
11
|
-
When I do something bad
|
12
|
-
Then fail
|
13
|
-
|
14
|
-
Scenario Outline: Passing wins
|
15
|
-
When I do something good with <thing>
|
16
|
-
Then fail
|
17
|
-
|
18
|
-
Examples:
|
19
|
-
| thing |
|
20
|
-
| money |
|
21
|
-
| time |
|
22
|
-
|
23
|
-
Scenario Outline: Passing flops
|
24
|
-
When I do something bad with <thing>
|
25
|
-
Then fail
|
26
|
-
|
27
|
-
Examples:
|
28
|
-
| thing |
|
29
|
-
| money |
|
30
|
-
| time |
|
31
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Feature: Passing sample
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given anything
|
5
|
-
|
6
|
-
Scenario: Winning
|
7
|
-
When I do something good
|
8
|
-
Then I should be successful
|
9
|
-
|
10
|
-
Scenario: Losing
|
11
|
-
When I do something bad
|
12
|
-
Then I should not be successful
|
13
|
-
|
14
|
-
Scenario Outline: Passing wins
|
15
|
-
When I do something good with <thing>
|
16
|
-
Then I should be successful
|
17
|
-
|
18
|
-
Examples:
|
19
|
-
| thing |
|
20
|
-
| money |
|
21
|
-
| time |
|
22
|
-
|
23
|
-
Scenario Outline: Passing flops
|
24
|
-
When I do something bad with <thing>
|
25
|
-
Then I should not be successful
|
26
|
-
|
27
|
-
Examples:
|
28
|
-
| thing |
|
29
|
-
| money |
|
30
|
-
| time |
|
31
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Given /^anything$/ do
|
2
|
-
end
|
3
|
-
|
4
|
-
When /^I do something good$/ do
|
5
|
-
end
|
6
|
-
|
7
|
-
When /^I do something bad$/ do
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^I do something good with (.+)$/ do |thing|
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^I do something bad with (.+)$/ do |thing|
|
14
|
-
end
|
15
|
-
|
16
|
-
Then /^I should not be successful$/ do
|
17
|
-
false.should_not == true
|
18
|
-
end
|
19
|
-
|
20
|
-
Then /^I should be successful$/ do
|
21
|
-
true.should == true
|
22
|
-
end
|
23
|
-
|
24
|
-
Then /^fail$/ do
|
25
|
-
false.should == true
|
26
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Undefined step definitions sample
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given anything
|
5
|
-
|
6
|
-
Scenario:
|
7
|
-
When I have this undefined step definition
|
8
|
-
Then fail
|
9
|
-
|
10
|
-
Scenario Outline:
|
11
|
-
When I have this undefined step definition
|
12
|
-
Then fail
|
13
|
-
|
14
|
-
Examples:
|
15
|
-
| thing |
|
16
|
-
| money |
|
17
|
-
| time |
|
data/spec/spec.opts
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require 'specjour'
|
4
|
-
require 'spec/autorun'
|
5
|
-
|
6
|
-
class NullObject
|
7
|
-
def method_missing(name, *args)
|
8
|
-
self
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
begin
|
13
|
-
Specjour::DbScrub
|
14
|
-
rescue LoadError
|
15
|
-
$stderr.puts "DbScrub failed to load properly, that's okay though"
|
16
|
-
end
|
17
|
-
|
18
|
-
Spec::Runner.configure do |config|
|
19
|
-
config.mock_with :rr
|
20
|
-
end
|
data/spec/specjour/cli_spec.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Specjour::CLI do
|
4
|
-
subject { Specjour::CLI.new }
|
5
|
-
let(:fake_pid) { 100_000_000 }
|
6
|
-
before do
|
7
|
-
stub(Specjour::CPU).cores.returns(27)
|
8
|
-
stub(Specjour::Dispatcher).new.returns(stub!)
|
9
|
-
stub(Specjour::Manager).new.returns(stub!)
|
10
|
-
stub(Specjour::Worker).new.returns(stub!)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#listen" do
|
14
|
-
let(:manager) { NullObject.new }
|
15
|
-
|
16
|
-
before do
|
17
|
-
stub(Dir).pwd { '/home/someone/foo-bar' }
|
18
|
-
end
|
19
|
-
|
20
|
-
def manager_receives_options(options)
|
21
|
-
expected_options = hash_including(options)
|
22
|
-
mock(Specjour::Manager).new(expected_options).returns(manager)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "defaults workers to system cores" do
|
26
|
-
manager_receives_options("worker_size" => 27)
|
27
|
-
Specjour::CLI.start %w(listen -p none)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "accepts an array of projects to listen to" do
|
31
|
-
manager_receives_options("registered_projects" => %w(one two three))
|
32
|
-
Specjour::CLI.start %w(listen --projects one two three)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "listens to the current path by default" do
|
36
|
-
manager_receives_options("registered_projects" => %w(foo-bar))
|
37
|
-
Specjour::CLI.start %w(listen)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "#dispatch" do
|
42
|
-
let(:dispatcher) { NullObject.new }
|
43
|
-
|
44
|
-
def dispatcher_receives_options(options)
|
45
|
-
expected_options = hash_including(options)
|
46
|
-
mock(Specjour::Dispatcher).new(expected_options).returns(dispatcher)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "defaults path to the current directory" do
|
50
|
-
stub(Dir).pwd.returns("eh")
|
51
|
-
dispatcher_receives_options("project_path" => "eh")
|
52
|
-
Specjour::CLI.start %w(dispatch)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "defaults workers to system cores" do
|
56
|
-
dispatcher_receives_options("worker_size" => 27)
|
57
|
-
Specjour::CLI.start %w(dispatch)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "accepts a project alias" do
|
61
|
-
dispatcher_receives_options("project_alias" => "eh")
|
62
|
-
Specjour::CLI.start %w(dispatch --alias eh)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "#work" do
|
67
|
-
it "starts a worker with the required parameters" do
|
68
|
-
worker = NullObject.new
|
69
|
-
args = {'project_path' => "eh", 'printer_uri' => "specjour://1.1.1.1:12345", 'number' => 1, 'task' => 'run_tests'}
|
70
|
-
mock(Specjour::Worker).new(hash_including(args)).returns(worker)
|
71
|
-
Specjour::CLI.start %w(work --project-path eh --printer-uri specjour://1.1.1.1:12345 --number 1 --task run_tests)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#handle_logging" do
|
76
|
-
before do
|
77
|
-
stub(subject).options.returns({})
|
78
|
-
end
|
79
|
-
|
80
|
-
it "enables logging" do
|
81
|
-
subject.options['log'] = true
|
82
|
-
mock(Specjour).new_logger(Logger::DEBUG).returns(stub!)
|
83
|
-
subject.send(:handle_logging)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "doesn't enable logging" do
|
87
|
-
dont_allow(Specjour).new_logger
|
88
|
-
subject.send(:handle_logging)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#prepare" do
|
93
|
-
let(:dispatcher) { NullObject.new }
|
94
|
-
|
95
|
-
def dispatcher_receives_options(options)
|
96
|
-
expected_options = hash_including(options)
|
97
|
-
mock(Specjour::Dispatcher).new(expected_options).returns(dispatcher)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "sets the worker task to 'prepare'" do
|
101
|
-
dispatcher_receives_options("worker_task" => "prepare")
|
102
|
-
Specjour::CLI.start %w(prepare)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|