gorgon 0.7.0.rc4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Gemfile.lock +2 -2
- data/lib/gorgon/version.rb +1 -1
- data/spec/crash_reporter_spec.rb +4 -4
- data/spec/failures_printer_spec.rb +9 -9
- data/spec/gem_command_handler_spec.rb +10 -10
- data/spec/gem_service_spec.rb +9 -9
- data/spec/gorgon_rspec_formatter_spec.rb +10 -10
- data/spec/job_state_spec.rb +5 -5
- data/spec/listener_spec.rb +21 -21
- data/spec/mini_test_runner_spec.rb +1 -1
- data/spec/originator_protocol_spec.rb +9 -9
- data/spec/originator_spec.rb +20 -20
- data/spec/ping_service_spec.rb +7 -7
- data/spec/pipe_forker_spec.rb +6 -6
- data/spec/progress_bar_view_spec.rb +9 -9
- data/spec/rspec_runner_spec.rb +3 -12
- data/spec/shutdown_manager_spec.rb +2 -2
- data/spec/source_tree_syncer_spec.rb +10 -10
- data/spec/worker_manager_spec.rb +11 -11
- data/spec/worker_spec.rb +21 -21
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Njg4ZmM0YTg5NWRkZTk0ZWU4ZWY4OTRiNjEwYTcxMmYwNGI1MzdjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODAxYjJlMDgyNjFhMDM1YjI2ZTU4ZTJiNzE3OTI4MzViNThmZTM2Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWYxYzg1NzAwNThjOTEzZDhjODZmMWU5Y2VmNTI4ODI3NWUyZWM5M2JhNWI0
|
10
|
+
YzI3NzE4N2RiODY0NDM1NmIzOGRlNzY5NjY2MTFiN2ZiNGM1NWIwNDEyOGJh
|
11
|
+
NzZmOTE0YzQyYTY2NGJlOTk1NGZkODFjODgyNDQ5MzQ4NGQ4MzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjE2ZjQyMzI5NmExYzBkYTJlZjVkMzczNGNiMzIzMTcyZjUwZWFkYzJiODAz
|
14
|
+
MjkyYTZkZTAwMmI4Nzc3NTJkZGQ2NjU3MGNiM2E3NzI3NDUyZmI5OWU3YTVk
|
15
|
+
MDdkNTA4ZDgwYTA0MDE2ZWY1OTcwMWJiY2IzNzExMGE2MmIzN2Y=
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gorgon (0.7.0
|
4
|
+
gorgon (0.7.0)
|
5
5
|
amqp (~> 1.1.0)
|
6
6
|
awesome_print
|
7
7
|
colorize (~> 0.5.8)
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
colorize (0.5.8)
|
22
22
|
diff-lcs (1.1.3)
|
23
23
|
eventmachine (1.0.3)
|
24
|
-
open4 (1.3.
|
24
|
+
open4 (1.3.0)
|
25
25
|
rake (0.9.2.2)
|
26
26
|
rspec (2.11.0)
|
27
27
|
rspec-core (~> 2.11.0)
|
data/lib/gorgon/version.rb
CHANGED
data/spec/crash_reporter_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'gorgon/crash_reporter'
|
2
2
|
|
3
3
|
describe "CrashReporter" do
|
4
|
-
let(:exchange) {
|
4
|
+
let(:exchange) { double("GorgonBunny Exchange", :publish => nil) }
|
5
5
|
let(:info) { {
|
6
6
|
:out_file => "stdout_file", :err_file => "stderr_file", :footer_text => "Text"
|
7
7
|
} }
|
@@ -22,14 +22,14 @@ describe "CrashReporter" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "calls send_crash_message" do
|
25
|
-
container_class.stub
|
25
|
+
container_class.stub(:'`').and_return "stdout text", "stderr text "
|
26
26
|
container_class.should_receive(:send_crash_message).with(exchange, "stdout text", "stderr text Text")
|
27
27
|
container_class.report_crash exchange, info
|
28
28
|
end
|
29
29
|
|
30
30
|
it "returns last lines of output from stderr message and footer text" do
|
31
|
-
container_class.stub
|
32
|
-
container_class.stub
|
31
|
+
container_class.stub(:'`').and_return "stdout text", "stderr text "
|
32
|
+
container_class.stub(:send_crash_message)
|
33
33
|
result = container_class.report_crash exchange, info
|
34
34
|
result.should == "stdout text\nstderr text Text"
|
35
35
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'gorgon/failures_printer'
|
2
2
|
|
3
3
|
describe FailuresPrinter do
|
4
|
-
let(:job_state) {
|
4
|
+
let(:job_state) { double("Job State", :add_observer => nil,
|
5
5
|
:is_job_complete? => true, :is_job_cancelled? => false,
|
6
6
|
:each_failed_test => nil,
|
7
7
|
:each_running_file => nil)}
|
8
|
-
let(:fd) {
|
8
|
+
let(:fd) {double("File descriptor", :write => nil)}
|
9
9
|
|
10
10
|
subject do
|
11
11
|
FailuresPrinter.new(job_state)
|
@@ -27,7 +27,7 @@ describe FailuresPrinter do
|
|
27
27
|
|
28
28
|
context "job is not completed nor cancelled" do
|
29
29
|
it "doesn't output anything" do
|
30
|
-
job_state.stub
|
30
|
+
job_state.stub(:is_job_complete? => false)
|
31
31
|
File.should_not_receive(:open)
|
32
32
|
@printer.update({})
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe FailuresPrinter do
|
|
35
35
|
|
36
36
|
context "job is completed" do
|
37
37
|
it "outputs failed tests return by job_state#each_failed_test" do
|
38
|
-
job_state.stub
|
38
|
+
job_state.stub(:each_failed_test).and_yield({:filename => "file1.rb"}).and_yield({:filename => "file2.rb"})
|
39
39
|
File.should_receive(:open).with(FailuresPrinter::OUTPUT_FILE, 'w+').and_yield fd
|
40
40
|
fd.should_receive(:write).with(Yajl::Encoder.encode(["file1.rb", "file2.rb"]))
|
41
41
|
@printer.update({})
|
@@ -44,20 +44,20 @@ describe FailuresPrinter do
|
|
44
44
|
|
45
45
|
context "job is cancelled" do
|
46
46
|
before do
|
47
|
-
job_state.stub
|
48
|
-
job_state.stub
|
47
|
+
job_state.stub(:is_job_complete?).and_return(false)
|
48
|
+
job_state.stub(:is_job_cancelled?).and_return(true)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "outputs failed tests return by job_state#each_failed_test" do
|
52
|
-
job_state.stub
|
52
|
+
job_state.stub(:each_failed_test).and_yield({:filename => "file1.rb"}).and_yield({:filename => "file2.rb"})
|
53
53
|
File.should_receive(:open).with(FailuresPrinter::OUTPUT_FILE, 'w+').and_yield fd
|
54
54
|
fd.should_receive(:write).once.with(Yajl::Encoder.encode(["file1.rb", "file2.rb"]))
|
55
55
|
@printer.update({})
|
56
56
|
end
|
57
57
|
|
58
58
|
it "outputs still-running files returns by job_state#each_running_file" do
|
59
|
-
job_state.stub
|
60
|
-
File.stub
|
59
|
+
job_state.stub(:each_running_file).and_yield("host1", "file1.rb").and_yield("host2", "file2.rb")
|
60
|
+
File.stub(:open).and_yield fd
|
61
61
|
fd.should_receive(:write).once.with(Yajl::Encoder.encode(["file1.rb", "file2.rb"]))
|
62
62
|
@printer.update({})
|
63
63
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'gorgon/gem_command_handler'
|
2
2
|
|
3
3
|
describe GemCommandHandler do
|
4
|
-
let(:exchange) {
|
5
|
-
let(:bunny) {
|
4
|
+
let(:exchange) { double("GorgonBunny Exchange", :publish => nil) }
|
5
|
+
let(:bunny) { double("GorgonBunny", :exchange => exchange, :stop => nil) }
|
6
6
|
|
7
7
|
let(:payload) {
|
8
8
|
{:type => :update, :reply_exchange_name => "name",
|
9
9
|
:body => {:gem_command => "cmd"}}
|
10
10
|
}
|
11
|
-
let(:stdin) {
|
12
|
-
let(:stdout) {
|
13
|
-
let(:stderr) {
|
14
|
-
let(:status) {
|
11
|
+
let(:stdin) { double("IO object", :close => nil)}
|
12
|
+
let(:stdout) { double("IO object", :read => "output", :close => nil)}
|
13
|
+
let(:stderr) { double("IO object", :read => "errors", :close => nil)}
|
14
|
+
let(:status) { double("Process Status", :exitstatus => 0)}
|
15
15
|
|
16
16
|
describe "#handle" do
|
17
17
|
before do
|
@@ -76,9 +76,9 @@ describe GemCommandHandler do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def stub_methods
|
79
|
-
Open4.stub
|
80
|
-
Process.stub
|
81
|
-
Yajl::Encoder.stub
|
82
|
-
@handler.stub
|
79
|
+
Open4.stub(:popen4).and_return([1, stdin, stdout, stderr])
|
80
|
+
Process.stub(:waitpid2).and_return([nil, status])
|
81
|
+
Yajl::Encoder.stub(:encode).and_return :json_msg
|
82
|
+
@handler.stub(:exit)
|
83
83
|
end
|
84
84
|
end
|
data/spec/gem_service_spec.rb
CHANGED
@@ -2,18 +2,18 @@ require 'gorgon/gem_service'
|
|
2
2
|
|
3
3
|
describe GemService do
|
4
4
|
let(:configuration){ {:connection => {:host => "host"}, :originator_log_file => "file.log"}}
|
5
|
-
let(:protocol) {
|
5
|
+
let(:protocol) { double("OriginatorProtocol", :connect => nil,
|
6
6
|
:receive_payloads => nil, :disconnect => nil,
|
7
7
|
:send_message_to_listeners => nil)}
|
8
|
-
let(:logger){
|
8
|
+
let(:logger){ double("Originator Logger", :log => nil, :log_message => nil)}
|
9
9
|
|
10
10
|
before do
|
11
|
-
$stdout.stub
|
11
|
+
$stdout.stub(:write)
|
12
12
|
GemService.any_instance.stub(:load_configuration_from_file).and_return configuration
|
13
|
-
EM.stub
|
14
|
-
EM.stub
|
15
|
-
OriginatorLogger.stub
|
16
|
-
OriginatorProtocol.stub
|
13
|
+
EM.stub(:run).and_yield
|
14
|
+
EM.stub(:add_periodic_timer).and_yield
|
15
|
+
OriginatorLogger.stub(:new).and_return logger
|
16
|
+
OriginatorProtocol.stub(:new).and_return(protocol)
|
17
17
|
@service = GemService.new
|
18
18
|
@command = "install"
|
19
19
|
end
|
@@ -38,7 +38,7 @@ describe GemService do
|
|
38
38
|
context "when it receives an running_command message" do
|
39
39
|
before do
|
40
40
|
payload = {:type => "running_command", :hostname => "host"}
|
41
|
-
protocol.stub
|
41
|
+
protocol.stub(:receive_payloads).and_yield Yajl::Encoder.encode(payload)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "writes to console" do
|
@@ -56,7 +56,7 @@ describe GemService do
|
|
56
56
|
before do
|
57
57
|
running_command_payload = {:type => "running_command", :hostname => "host"}
|
58
58
|
complete_payload = {:type => "command_completed", :hostname => "host"}
|
59
|
-
protocol.stub
|
59
|
+
protocol.stub(:receive_payloads).and_yield(Yajl::Encoder.encode(running_command_payload))
|
60
60
|
.and_yield(Yajl::Encoder.encode(complete_payload))
|
61
61
|
end
|
62
62
|
|
@@ -3,26 +3,26 @@ require 'gorgon/gorgon_rspec_formatter'
|
|
3
3
|
BaseFormatter = RSpec::Core::Formatters::GorgonRspecFormatter
|
4
4
|
|
5
5
|
describe RSpec::Core::Formatters::GorgonRspecFormatter do
|
6
|
-
let(:example) {
|
6
|
+
let(:example) {double("Example", :description => "description",
|
7
7
|
:full_description => "Full_Description",
|
8
8
|
:metadata => {:file_path => "path/to/file", :line_number => 2},
|
9
9
|
:execution_result => {:status => "passed"}, :exception => nil)}
|
10
|
-
let(:fail_example) {
|
10
|
+
let(:fail_example) {double("Example", :description => "description",
|
11
11
|
:full_description => "Full_Description",
|
12
12
|
:metadata => {:file_path => "path/to/file", :line_number => 2},
|
13
13
|
:execution_result => {:status => "failed"}, :exception => nil)}
|
14
14
|
|
15
|
-
let(:exception) {
|
15
|
+
let(:exception) { double("Exception", :class => Object, :message => "some msg",
|
16
16
|
:backtrace => "backtrace")}
|
17
17
|
|
18
|
-
let(:output) {
|
18
|
+
let(:output) { double("StringIO", :write => nil, :close => nil) }
|
19
19
|
|
20
20
|
before do
|
21
21
|
@formatter = BaseFormatter.new(output)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns an array of hashes when there are failures" do
|
25
|
-
@formatter.stub
|
25
|
+
@formatter.stub(:examples).and_return([example, fail_example])
|
26
26
|
|
27
27
|
expected_result = [{:test_name => "Full_Description: line 2", :description => "description",
|
28
28
|
:full_description => "Full_Description", :status => "failed",
|
@@ -33,7 +33,7 @@ describe RSpec::Core::Formatters::GorgonRspecFormatter do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns an empty array when all examples pass" do
|
36
|
-
@formatter.stub
|
36
|
+
@formatter.stub(:examples).and_return([example, example])
|
37
37
|
|
38
38
|
output.should_receive(:write).with("[]")
|
39
39
|
@formatter.stop
|
@@ -41,8 +41,8 @@ describe RSpec::Core::Formatters::GorgonRspecFormatter do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "returns an empty array when all examples are pending" do
|
44
|
-
example.stub
|
45
|
-
@formatter.stub
|
44
|
+
example.stub(:execution_result).and_return(:status => "pending")
|
45
|
+
@formatter.stub(:examples).and_return([example, example])
|
46
46
|
|
47
47
|
output.should_receive(:write).with("[]")
|
48
48
|
@formatter.stop
|
@@ -50,8 +50,8 @@ describe RSpec::Core::Formatters::GorgonRspecFormatter do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "returns exception details if there is an exception" do
|
53
|
-
fail_example.stub
|
54
|
-
@formatter.stub
|
53
|
+
fail_example.stub(:exception).and_return(exception)
|
54
|
+
@formatter.stub(:examples).and_return([fail_example])
|
55
55
|
expected_result = [{:test_name => "Full_Description: line 2", :description => "description",
|
56
56
|
:full_description => "Full_Description", :status => "failed",
|
57
57
|
:file_path => "path/to/file", :line_number => 2, :class => Object.name,
|
data/spec/job_state_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe JobState do
|
|
6
6
|
:type => "pass", :failures => []}
|
7
7
|
}
|
8
8
|
|
9
|
-
let (:host_state){
|
9
|
+
let (:host_state){ double("Host State", :file_started => nil, :file_finished => nil)}
|
10
10
|
|
11
11
|
subject { JobState.new 5 }
|
12
12
|
it { should respond_to :failed_files_count }
|
@@ -62,14 +62,14 @@ describe JobState do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "doesn't create a new HostState object if this is not the first file started by 'hostname'" do
|
65
|
-
HostState.stub
|
65
|
+
HostState.stub(:new).and_return host_state
|
66
66
|
@job_state.file_started(payload)
|
67
67
|
HostState.should_not_receive(:new)
|
68
68
|
@job_state.file_started(payload)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "calls #file_started on HostState object representing 'hostname'" do
|
72
|
-
HostState.stub
|
72
|
+
HostState.stub(:new).and_return host_state
|
73
73
|
host_state.should_receive(:file_started).with("worker_id", "file_name")
|
74
74
|
@job_state.file_started({:hostname => "hostname",
|
75
75
|
:worker_id => "worker_id",
|
@@ -85,7 +85,7 @@ describe JobState do
|
|
85
85
|
|
86
86
|
describe "#file_finished" do
|
87
87
|
before do
|
88
|
-
HostState.stub
|
88
|
+
HostState.stub(:new).and_return host_state
|
89
89
|
@job_state.file_started payload
|
90
90
|
end
|
91
91
|
|
@@ -124,7 +124,7 @@ describe JobState do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "tells to the proper HostState object that a file finished in that host" do
|
127
|
-
HostState.stub
|
127
|
+
HostState.stub(:new).and_return host_state
|
128
128
|
@job_state.file_started({:hostname => "hostname",
|
129
129
|
:worker_id => "worker_id",
|
130
130
|
:filename => "file_name"})
|
data/spec/listener_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require 'gorgon/listener'
|
|
2
2
|
|
3
3
|
describe Listener do
|
4
4
|
let(:connection_information) { double }
|
5
|
-
let(:queue) {
|
6
|
-
let(:exchange) {
|
7
|
-
let(:bunny) {
|
8
|
-
let(:logger) {
|
5
|
+
let(:queue) { double("GorgonBunny Queue", :bind => nil) }
|
6
|
+
let(:exchange) { double("GorgonBunny Exchange", :publish => nil) }
|
7
|
+
let(:bunny) { double("GorgonBunny", :start => nil, :queue => queue, :exchange => exchange) }
|
8
|
+
let(:logger) { double("Logger", :info => true, :datetime_format= => "")}
|
9
9
|
|
10
10
|
before do
|
11
11
|
Logger.stub(:new).and_return(logger)
|
@@ -138,7 +138,7 @@ describe Listener do
|
|
138
138
|
let(:ping_payload) { [nil, nil, Yajl::Encoder.encode({:type => "ping", :reply_exchange_name => "name", :body => {}}) ] }
|
139
139
|
|
140
140
|
before do
|
141
|
-
queue.stub
|
141
|
+
queue.stub(:pop => ping_payload)
|
142
142
|
listener.stub(:configuration).and_return({:worker_slots => 3})
|
143
143
|
end
|
144
144
|
|
@@ -160,10 +160,10 @@ describe Listener do
|
|
160
160
|
:body => {:command => command}}
|
161
161
|
}
|
162
162
|
|
163
|
-
let(:gem_command_handler) {
|
163
|
+
let(:gem_command_handler) { double("GemCommandHandler", :handle => nil) }
|
164
164
|
let(:configuration) { {:worker_slots => 3} }
|
165
165
|
before do
|
166
|
-
queue.stub
|
166
|
+
queue.stub(:pop => [nil, nil, Yajl::Encoder.encode(payload)])
|
167
167
|
listener.stub(:configuration).and_return(configuration)
|
168
168
|
end
|
169
169
|
|
@@ -181,14 +181,14 @@ describe Listener do
|
|
181
181
|
:sync_exclude => ["log"], :callbacks => {:a_callback => "path/to/callback"}
|
182
182
|
}}
|
183
183
|
|
184
|
-
let(:syncer) {
|
184
|
+
let(:syncer) { double("SourceTreeSyncer", :sync => nil, :exclude= => nil, :success? => true,
|
185
185
|
:output => "some output", :errors => "some errors",
|
186
186
|
:remove_temp_dir => nil, :sys_command => "rsync ...")}
|
187
|
-
let(:process_status) {
|
188
|
-
let(:callback_handler) {
|
189
|
-
let(:stdin) {
|
190
|
-
let(:stdout) {
|
191
|
-
let(:stderr) {
|
187
|
+
let(:process_status) { double("Process Status", :exitstatus => 0)}
|
188
|
+
let(:callback_handler) { double("Callback Handler", :after_sync => nil) }
|
189
|
+
let(:stdin) { double("IO object", :write => nil, :close => nil)}
|
190
|
+
let(:stdout) { double("IO object", :read => nil, :close => nil)}
|
191
|
+
let(:stderr) { double("IO object", :read => nil, :close => nil)}
|
192
192
|
|
193
193
|
before do
|
194
194
|
stub_classes
|
@@ -205,9 +205,9 @@ describe Listener do
|
|
205
205
|
|
206
206
|
context "syncer#sync fails" do
|
207
207
|
before do
|
208
|
-
syncer.stub
|
209
|
-
syncer.stub
|
210
|
-
syncer.stub
|
208
|
+
syncer.stub(:success?).and_return false
|
209
|
+
syncer.stub(:output).and_return "some output"
|
210
|
+
syncer.stub(:errors).and_return "some errors"
|
211
211
|
end
|
212
212
|
|
213
213
|
it "aborts current job" do
|
@@ -254,11 +254,11 @@ describe Listener do
|
|
254
254
|
private
|
255
255
|
|
256
256
|
def stub_classes
|
257
|
-
SourceTreeSyncer.stub
|
258
|
-
CallbackHandler.stub
|
259
|
-
Open4.stub
|
260
|
-
Process.stub
|
261
|
-
Socket.stub
|
257
|
+
SourceTreeSyncer.stub(:new).and_return syncer
|
258
|
+
CallbackHandler.stub(:new).and_return callback_handler
|
259
|
+
Open4.stub(:popen4).and_return([1, stdin, stdout, stderr])
|
260
|
+
Process.stub(:waitpid2).and_return([0, process_status])
|
261
|
+
Socket.stub(:gethostname).and_return("hostname")
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end
|
@@ -7,7 +7,7 @@ describe MiniTestRunner do
|
|
7
7
|
|
8
8
|
describe "#run_file" do
|
9
9
|
|
10
|
-
let(:runner) {
|
10
|
+
let(:runner) {double("MiniTestUnitRunner", :run => nil, :report => ["report"])}
|
11
11
|
before do
|
12
12
|
Object.stub(:load)
|
13
13
|
MiniTestUnitRunner.stub(:new).and_return(runner)
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'gorgon/originator_protocol'
|
2
2
|
|
3
3
|
describe OriginatorProtocol do
|
4
|
-
let(:connection) {
|
5
|
-
let(:queue) {
|
4
|
+
let(:connection) { double("Connection", :disconnect => nil, :on_closed => nil)}
|
5
|
+
let(:queue) { double("Queue", :bind => nil, :subscribe => nil, :name => "queue", :purge => nil,
|
6
6
|
:delete => nil) }
|
7
|
-
let(:exchange) {
|
8
|
-
let(:channel) {
|
7
|
+
let(:exchange) { double("Exchange", :publish => nil, :name => "exchange", :delete => nil) }
|
8
|
+
let(:channel) { double("Channel", :queue => queue, :direct => exchange, :fanout => exchange,
|
9
9
|
:default_exchange => exchange) }
|
10
|
-
let(:logger){
|
10
|
+
let(:logger){ double("Logger", :log => nil)}
|
11
11
|
|
12
12
|
before do
|
13
|
-
AMQP.stub
|
14
|
-
AMQP::Channel.stub
|
13
|
+
AMQP.stub(:connect).and_return connection
|
14
|
+
AMQP::Channel.stub(:new).and_return channel
|
15
15
|
@originator_p = OriginatorProtocol.new logger
|
16
16
|
@conn_information = {:host => "host"}
|
17
17
|
end
|
@@ -38,13 +38,13 @@ describe OriginatorProtocol do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "opens a reply and exchange queue" do
|
41
|
-
UUIDTools::UUID.stub
|
41
|
+
UUIDTools::UUID.stub(:timestamp_create).and_return 1
|
42
42
|
channel.should_receive(:queue).once.with("reply_queue_1", :auto_delete => true)
|
43
43
|
@originator_p.connect @conn_information
|
44
44
|
end
|
45
45
|
|
46
46
|
it "opens a reply exchange and binds reply queue to it" do
|
47
|
-
UUIDTools::UUID.stub
|
47
|
+
UUIDTools::UUID.stub(:timestamp_create).and_return 1
|
48
48
|
channel.should_receive(:direct).with("reply_exchange_1", :auto_delete => true)
|
49
49
|
queue.should_receive(:bind).with(exchange)
|
50
50
|
@originator_p.connect @conn_information
|
data/spec/originator_spec.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'gorgon/originator'
|
2
2
|
|
3
3
|
describe Originator do
|
4
|
-
let(:protocol){
|
4
|
+
let(:protocol){ double("Originator Protocol", :connect => nil, :publish_files => nil,
|
5
5
|
:publish_job => nil, :receive_payloads => nil, :cancel_job => nil,
|
6
6
|
:disconnect => nil)}
|
7
7
|
|
8
8
|
let(:configuration){ {:job => {}, :files => ["some/file"], :file_server => {:host => 'host-name'}}}
|
9
|
-
let(:job_state){
|
9
|
+
let(:job_state){ double("JobState", :is_job_complete? => false, :file_finished => nil,
|
10
10
|
:add_observer => nil)}
|
11
|
-
let(:progress_bar_view){
|
12
|
-
let(:originator_logger){
|
13
|
-
let(:source_tree_syncer) {
|
11
|
+
let(:progress_bar_view){ double("Progress Bar View", :show => nil)}
|
12
|
+
let(:originator_logger){ double("Originator Logger", :log => nil, :log_message => nil)}
|
13
|
+
let(:source_tree_syncer) { double("Source Tree Syncer", :push => nil, :exclude= => nil, :success? => true,
|
14
14
|
:sys_command => 'command')}
|
15
15
|
|
16
16
|
before do
|
@@ -26,14 +26,14 @@ describe Originator do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "creates a JobState instance and passes total files" do
|
29
|
-
@originator.stub
|
29
|
+
@originator.stub(:files).and_return ["a file", "other file"]
|
30
30
|
JobState.should_receive(:new).with(2).and_return job_state
|
31
31
|
|
32
32
|
@originator.publish
|
33
33
|
end
|
34
34
|
|
35
35
|
it "creates a ProgressBarView and show" do
|
36
|
-
JobState.stub
|
36
|
+
JobState.stub(:new).and_return job_state
|
37
37
|
ProgressBarView.should_receive(:new).with(job_state).and_return progress_bar_view
|
38
38
|
progress_bar_view.should_receive(:show)
|
39
39
|
@originator.publish
|
@@ -64,7 +64,7 @@ describe Originator do
|
|
64
64
|
|
65
65
|
it 'tells ShutdownManager to cancel_job' do
|
66
66
|
shutdown_manager = double('ShutdownManager')
|
67
|
-
JobState.stub
|
67
|
+
JobState.stub(:new).and_return job_state
|
68
68
|
|
69
69
|
ShutdownManager.should_receive(:new).
|
70
70
|
with(hash_including(protocol: protocol, job_state: job_state)).
|
@@ -79,7 +79,7 @@ describe Originator do
|
|
79
79
|
describe "#cleanup_if_job_complete" do
|
80
80
|
before do
|
81
81
|
stub_methods
|
82
|
-
JobState.stub
|
82
|
+
JobState.stub(:new).and_return job_state
|
83
83
|
@originator.publish
|
84
84
|
end
|
85
85
|
|
@@ -89,7 +89,7 @@ describe Originator do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it "disconnect if job is complete" do
|
92
|
-
job_state.stub
|
92
|
+
job_state.stub(:is_job_complete?).and_return true
|
93
93
|
protocol.should_receive(:disconnect)
|
94
94
|
@originator.cleanup_if_job_complete
|
95
95
|
end
|
@@ -98,7 +98,7 @@ describe Originator do
|
|
98
98
|
describe "#handle_reply" do
|
99
99
|
before do
|
100
100
|
stub_methods
|
101
|
-
JobState.stub
|
101
|
+
JobState.stub(:new).and_return job_state
|
102
102
|
@originator.publish
|
103
103
|
end
|
104
104
|
|
@@ -130,14 +130,14 @@ describe Originator do
|
|
130
130
|
|
131
131
|
describe "#job_definition" do
|
132
132
|
it "returns a JobDefinition object" do
|
133
|
-
@originator.stub
|
133
|
+
@originator.stub(:configuration).and_return configuration
|
134
134
|
job_definition = JobDefinition.new
|
135
135
|
JobDefinition.should_receive(:new).and_return job_definition
|
136
136
|
@originator.job_definition.should equal job_definition
|
137
137
|
end
|
138
138
|
|
139
139
|
it "builds source_tree_path if it was not specified in the configuration" do
|
140
|
-
@originator.stub
|
140
|
+
@originator.stub(:configuration).and_return(configuration.merge(:file_server => {:host => 'host-name'}))
|
141
141
|
Socket.stub(:gethostname => 'my-host')
|
142
142
|
Dir.stub(:pwd => 'dir')
|
143
143
|
|
@@ -145,7 +145,7 @@ describe Originator do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it "returns source_tree_path specified in configuration if it is present" do
|
148
|
-
@originator.stub
|
148
|
+
@originator.stub(:configuration).and_return({:job => {:source_tree_path => "login@host:path/to/dir"}})
|
149
149
|
@originator.job_definition.source_tree_path.should == "login@host:path/to/dir"
|
150
150
|
end
|
151
151
|
end
|
@@ -153,12 +153,12 @@ describe Originator do
|
|
153
153
|
private
|
154
154
|
|
155
155
|
def stub_methods
|
156
|
-
EventMachine.stub
|
157
|
-
ProgressBarView.stub
|
158
|
-
OriginatorProtocol.stub
|
159
|
-
@originator.stub
|
160
|
-
@originator.stub
|
161
|
-
@originator.stub
|
156
|
+
EventMachine.stub(:run).and_yield
|
157
|
+
ProgressBarView.stub(:new).and_return progress_bar_view
|
158
|
+
OriginatorProtocol.stub(:new).and_return protocol
|
159
|
+
@originator.stub(:configuration).and_return configuration
|
160
|
+
@originator.stub(:connection_information).and_return 'host'
|
161
|
+
@originator.stub(:job_definition).and_return JobDefinition.new
|
162
162
|
end
|
163
163
|
|
164
164
|
def start_payload
|
data/spec/ping_service_spec.rb
CHANGED
@@ -3,17 +3,17 @@ require 'gorgon/ping_service'
|
|
3
3
|
describe "PingService" do
|
4
4
|
describe "#ping_listeners" do
|
5
5
|
let(:configuration){ {:connection => {:host => "host"}, :originator_log_file => "file.log"}}
|
6
|
-
let(:protocol) {
|
6
|
+
let(:protocol) { double("OriginatorProtocol", :connect => nil, :ping => nil,
|
7
7
|
:receive_payloads => nil, :disconnect => nil,
|
8
8
|
:send_message_to_listeners => nil)}
|
9
|
-
let(:logger){
|
9
|
+
let(:logger){ double("Originator Logger", :log => nil, :log_message => nil)}
|
10
10
|
|
11
11
|
before do
|
12
|
-
$stdout.stub
|
12
|
+
$stdout.stub(:write)
|
13
13
|
PingService.any_instance.stub(:load_configuration_from_file).and_return configuration
|
14
|
-
EventMachine.stub
|
15
|
-
EM.stub
|
16
|
-
OriginatorLogger.stub
|
14
|
+
EventMachine.stub(:run).and_yield
|
15
|
+
EM.stub(:add_timer).and_yield
|
16
|
+
OriginatorLogger.stub(:new).and_return logger
|
17
17
|
end
|
18
18
|
|
19
19
|
it "connnects and calls OriginatorProtocol#send_message_to_listeners" do
|
@@ -25,7 +25,7 @@ describe "PingService" do
|
|
25
25
|
|
26
26
|
context "after sending ping messages" do
|
27
27
|
before do
|
28
|
-
OriginatorProtocol.stub
|
28
|
+
OriginatorProtocol.stub(:new).and_return(protocol)
|
29
29
|
@service = PingService.new
|
30
30
|
end
|
31
31
|
|
data/spec/pipe_forker_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'gorgon/pipe_forker'
|
2
2
|
|
3
3
|
describe PipeForker do
|
4
|
-
let(:io_pipe) {
|
5
|
-
let(:pipe) {
|
4
|
+
let(:io_pipe) { double("IO object", :close => nil)}
|
5
|
+
let(:pipe) {double("Pipe", :write => io_pipe)}
|
6
6
|
|
7
7
|
let(:container_class) do
|
8
8
|
Class.new do
|
@@ -11,10 +11,10 @@ describe PipeForker do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
before do
|
14
|
-
IO.stub
|
15
|
-
STDIN.stub
|
16
|
-
container_class.stub
|
17
|
-
container_class.stub
|
14
|
+
IO.stub(:pipe).and_return([io_pipe, io_pipe])
|
15
|
+
STDIN.stub(:reopen)
|
16
|
+
container_class.stub(:fork).and_yield.and_return(1)
|
17
|
+
container_class.stub(:exit)
|
18
18
|
end
|
19
19
|
|
20
20
|
describe ".pipe_fork" do
|
@@ -28,7 +28,7 @@ describe ProgressBarView do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#update" do
|
31
|
-
let(:progress_bar) {
|
31
|
+
let(:progress_bar) { double("Progress Bar", :title= => nil, :progress= => nil, :format => nil,
|
32
32
|
:finished? => false)}
|
33
33
|
let(:payload) {
|
34
34
|
{ :filename => "path/file.rb",
|
@@ -37,11 +37,11 @@ describe ProgressBarView do
|
|
37
37
|
}
|
38
38
|
|
39
39
|
before do
|
40
|
-
ProgressBar.stub
|
40
|
+
ProgressBar.stub(:create).and_return progress_bar
|
41
41
|
@job_state = JobState.new 2
|
42
|
-
@job_state.stub
|
42
|
+
@job_state.stub(:state).and_return :running
|
43
43
|
@progress_bar_view = ProgressBarView.new @job_state
|
44
|
-
$stdout.stub
|
44
|
+
$stdout.stub(:write)
|
45
45
|
@progress_bar_view.show
|
46
46
|
end
|
47
47
|
|
@@ -74,8 +74,8 @@ describe ProgressBarView do
|
|
74
74
|
|
75
75
|
it "prints failures and finish progress_bar when job is done" do
|
76
76
|
@progress_bar_view.update
|
77
|
-
@job_state.stub
|
78
|
-
@job_state.stub
|
77
|
+
@job_state.stub(:each_failed_test).and_yield(payload)
|
78
|
+
@job_state.stub(:is_job_complete?).and_return :true
|
79
79
|
$stdout.should_receive(:write).with(/Failure messages/)
|
80
80
|
@progress_bar_view.update
|
81
81
|
end
|
@@ -83,11 +83,11 @@ describe ProgressBarView do
|
|
83
83
|
context "when job is cancelled" do
|
84
84
|
before do
|
85
85
|
@progress_bar_view.update
|
86
|
-
@job_state.stub
|
86
|
+
@job_state.stub(:is_job_cancelled?).and_return :true
|
87
87
|
end
|
88
88
|
|
89
89
|
it "prints failures and finish progress_bar when job is cancelled" do
|
90
|
-
@job_state.stub
|
90
|
+
@job_state.stub(:each_failed_test).and_yield(payload)
|
91
91
|
$stdout.should_receive(:write).with(/Failure messages/)
|
92
92
|
@progress_bar_view.update
|
93
93
|
end
|
@@ -103,7 +103,7 @@ describe ProgressBarView do
|
|
103
103
|
let(:crash_message) {{:type => "crash", :hostname => "host",
|
104
104
|
:stdout => "some output", :stderr => "some errors"}}
|
105
105
|
it "prints info about crash in standard error" do
|
106
|
-
$stderr.stub
|
106
|
+
$stderr.stub(:write)
|
107
107
|
$stderr.should_receive(:write).with(/crash.*host/i)
|
108
108
|
$stderr.should_receive(:write).with(/some output/i)
|
109
109
|
$stderr.should_receive(:write).with(/some errors/i)
|
data/spec/rspec_runner_spec.rb
CHANGED
@@ -11,8 +11,7 @@ describe RspecRunner do
|
|
11
11
|
|
12
12
|
before do
|
13
13
|
RSpec::Core::Runner.stub(:run)
|
14
|
-
|
15
|
-
instance_variable_set: nil)
|
14
|
+
RspecRunner.stub(:keep_config_modules).and_yield
|
16
15
|
end
|
17
16
|
|
18
17
|
it "uses Rspec runner to run filename and uses the correct options" do
|
@@ -30,19 +29,11 @@ describe RspecRunner do
|
|
30
29
|
end
|
31
30
|
|
32
31
|
it "parses the output of the Runner and returns it" do
|
33
|
-
str_io =
|
34
|
-
StringIO.stub
|
32
|
+
str_io = double("StringIO", :rewind => nil, :read => :content)
|
33
|
+
StringIO.stub(:new).and_return(str_io)
|
35
34
|
Yajl::Parser.any_instance.should_receive(:parse).with(:content).and_return :result
|
36
35
|
RspecRunner.run_file("file").should == :result
|
37
36
|
end
|
38
|
-
|
39
|
-
# since configuration is reset on each run
|
40
|
-
# https://github.com/rspec/rspec-core/issues/621
|
41
|
-
it 'restore initial rspec configuration' do
|
42
|
-
RSpec.should_receive(:instance_variable_set).
|
43
|
-
with(:@configuration, configuration)
|
44
|
-
RspecRunner.run_file "file"
|
45
|
-
end
|
46
37
|
end
|
47
38
|
|
48
39
|
describe "#runner" do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'gorgon/shutdown_manager'
|
2
2
|
|
3
3
|
describe ShutdownManager do
|
4
|
-
let(:protocol){
|
4
|
+
let(:protocol){ double("Originator Protocol", :cancel_job => nil, :disconnect => nil)}
|
5
5
|
|
6
|
-
let(:job_state){
|
6
|
+
let(:job_state){ double("JobState", cancel: nil)}
|
7
7
|
|
8
8
|
describe '#cancel_job' do
|
9
9
|
it "call JobState#cancel" do
|
@@ -10,10 +10,10 @@ describe SourceTreeSyncer.new("") do
|
|
10
10
|
it { should respond_to :output }
|
11
11
|
it { should respond_to :errors }
|
12
12
|
|
13
|
-
let(:stdin) {
|
14
|
-
let(:stdout) {
|
15
|
-
let(:stderr) {
|
16
|
-
let(:status) {
|
13
|
+
let(:stdin) { double("IO object", :close => nil)}
|
14
|
+
let(:stdout) { double("IO object", :read => nil, :close => nil)}
|
15
|
+
let(:stderr) { double("IO object", :read => nil, :close => nil)}
|
16
|
+
let(:status) { double("Process Status", :exitstatus => 0)}
|
17
17
|
|
18
18
|
before do
|
19
19
|
@syncer = SourceTreeSyncer.new "path/to/source"
|
@@ -112,11 +112,11 @@ describe SourceTreeSyncer.new("") do
|
|
112
112
|
private
|
113
113
|
|
114
114
|
def stub_utilities_methods
|
115
|
-
Dir.stub
|
116
|
-
Dir.stub
|
117
|
-
Open4.stub
|
118
|
-
Process.stub
|
119
|
-
FileUtils.stub
|
120
|
-
@syncer.stub
|
115
|
+
Dir.stub(:mktmpdir).and_return("tmp/dir")
|
116
|
+
Dir.stub(:chdir)
|
117
|
+
Open4.stub(:popen4).and_return([1, stdin, stdout, stderr])
|
118
|
+
Process.stub(:waitpid2).and_return([nil, status])
|
119
|
+
FileUtils.stub(:remove_entry_secure)
|
120
|
+
@syncer.stub(:system)
|
121
121
|
end
|
122
122
|
end
|
data/spec/worker_manager_spec.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'gorgon/worker_manager'
|
2
2
|
|
3
3
|
describe WorkerManager do
|
4
|
-
let(:exchange) {
|
5
|
-
let(:queue) {
|
4
|
+
let(:exchange) { double("GorgonBunny Exchange", :publish => nil) }
|
5
|
+
let(:queue) { double("Queue", :bind => nil, :subscribe => nil, :delete => nil,
|
6
6
|
:pop => {:payload => :queue_empty}) }
|
7
|
-
let(:bunny) {
|
7
|
+
let(:bunny) { double("GorgonBunny", :start => nil, :exchange => exchange,
|
8
8
|
:queue => queue, :stop => nil) }
|
9
9
|
before do
|
10
|
-
STDIN.stub
|
11
|
-
STDOUT.stub
|
12
|
-
STDERR.stub
|
13
|
-
STDOUT.stub
|
14
|
-
STDERR.stub
|
15
|
-
GorgonBunny.stub
|
16
|
-
Configuration.stub
|
17
|
-
EventMachine.stub
|
10
|
+
STDIN.stub(:read).and_return "{}"
|
11
|
+
STDOUT.stub(:reopen)
|
12
|
+
STDERR.stub(:reopen)
|
13
|
+
STDOUT.stub(:sync)
|
14
|
+
STDERR.stub(:sync)
|
15
|
+
GorgonBunny.stub(:new).and_return(bunny)
|
16
|
+
Configuration.stub(:load_configuration_from_file).and_return({})
|
17
|
+
EventMachine.stub(:run).and_yield
|
18
18
|
end
|
19
19
|
|
20
20
|
describe ".build" do
|
data/spec/worker_spec.rb
CHANGED
@@ -16,8 +16,8 @@ describe Worker do
|
|
16
16
|
let(:file_queue) { double("Queue") }
|
17
17
|
let(:reply_exchange) { double("Exchange", :publish => nil) }
|
18
18
|
let(:fake_amqp) { fake_amqp = FakeAmqp.new file_queue, reply_exchange }
|
19
|
-
let(:callback_handler) {
|
20
|
-
let(:job_definition) {
|
19
|
+
let(:callback_handler) { double("Callback Handler", :before_start => nil, :after_complete => nil) }
|
20
|
+
let(:job_definition) {double("JobDefinition", :callbacks => ["/path/to/callback"],
|
21
21
|
:file_queue_name => "queue",
|
22
22
|
:reply_exchange_name => "exchange")}
|
23
23
|
|
@@ -36,9 +36,9 @@ describe Worker do
|
|
36
36
|
let(:config) { {:connection => "", :log_file => "path/to/log_file"} }
|
37
37
|
before do
|
38
38
|
stub_streams
|
39
|
-
AmqpService.stub
|
40
|
-
CallbackHandler.stub
|
41
|
-
Worker.stub
|
39
|
+
AmqpService.stub(:new).and_return fake_amqp
|
40
|
+
CallbackHandler.stub(:new).and_return callback_handler
|
41
|
+
Worker.stub(:new)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "redirects output to a file since writing to a pipe may block when pipe is full" do
|
@@ -70,7 +70,7 @@ few lines of output and send it to originator. Order matters" do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "creates a new worker" do
|
73
|
-
JobDefinition.stub
|
73
|
+
JobDefinition.stub(:new).and_return job_definition
|
74
74
|
Worker.should_receive(:new).with(params)
|
75
75
|
Worker.build 1, config
|
76
76
|
end
|
@@ -82,7 +82,7 @@ few lines of output and send it to originator. Order matters" do
|
|
82
82
|
stub_const("MiniTest", :test)
|
83
83
|
Worker.any_instance.stub(:initialize_logger)
|
84
84
|
@worker = Worker.new params
|
85
|
-
@worker.stub
|
85
|
+
@worker.stub(:require_relative)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'should do nothing if the file queue is empty' do
|
@@ -100,7 +100,7 @@ few lines of output and send it to originator. Order matters" do
|
|
100
100
|
end
|
101
101
|
reply_exchange.should_receive(:publish).with(any_args())
|
102
102
|
|
103
|
-
TestRunner.stub
|
103
|
+
TestRunner.stub(:run_file).and_return({:type => :pass, :time => 0})
|
104
104
|
|
105
105
|
@worker.work
|
106
106
|
end
|
@@ -115,13 +115,13 @@ few lines of output and send it to originator. Order matters" do
|
|
115
115
|
msg[:filename].should == 'testfile1'
|
116
116
|
end
|
117
117
|
|
118
|
-
TestRunner.stub
|
118
|
+
TestRunner.stub(:run_file).and_return({:type => :pass, :time => 0})
|
119
119
|
|
120
120
|
@worker.work
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should send finish message when test run has failures" do
|
124
|
-
failures =
|
124
|
+
failures = double
|
125
125
|
|
126
126
|
file_queue.should_receive(:pop).and_return("testfile1", nil)
|
127
127
|
|
@@ -133,7 +133,7 @@ few lines of output and send it to originator. Order matters" do
|
|
133
133
|
msg[:failures].should == failures
|
134
134
|
end
|
135
135
|
|
136
|
-
TestRunner.stub
|
136
|
+
TestRunner.stub(:run_file).and_return({:type => :fail, :time => 0, :failures => failures})
|
137
137
|
|
138
138
|
@worker.work
|
139
139
|
end
|
@@ -165,8 +165,8 @@ few lines of output and send it to originator. Order matters" do
|
|
165
165
|
|
166
166
|
# ruby 1.9 defines MiniTest by default, so let's remove it for these test cases
|
167
167
|
Object.send(:remove_const, :MiniTest)
|
168
|
-
file_queue.stub
|
169
|
-
File.stub
|
168
|
+
file_queue.stub(:pop).and_return("file_test.rb", nil)
|
169
|
+
File.stub(:read).and_return("")
|
170
170
|
end
|
171
171
|
|
172
172
|
it "runs file using TestUnitRunner when file doesn't end in _spec and Test is defined" do
|
@@ -179,7 +179,7 @@ few lines of output and send it to originator. Order matters" do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "runs file using RspecRunner when file finishes in _spec.rb and Rspec is defined" do
|
182
|
-
file_queue.stub
|
182
|
+
file_queue.stub(:pop).and_return("file_spec.rb", nil)
|
183
183
|
|
184
184
|
@worker.should_receive(:require_relative).with "rspec_runner"
|
185
185
|
TestRunner.should_receive(:run_file).with("file_spec.rb", RspecRunner).and_return({})
|
@@ -197,7 +197,7 @@ few lines of output and send it to originator. Order matters" do
|
|
197
197
|
|
198
198
|
it "runs file using TestUnitRunner when file doesn't end in _spec.rb, MiniTest is defined but project is using test-unit gem" do
|
199
199
|
MiniTest = Temp
|
200
|
-
File.stub
|
200
|
+
File.stub(:read).and_return("test-unit")
|
201
201
|
stub_const("Test", :test_unit)
|
202
202
|
|
203
203
|
@worker.should_receive(:require_relative).with "test_unit_runner"
|
@@ -208,7 +208,7 @@ few lines of output and send it to originator. Order matters" do
|
|
208
208
|
|
209
209
|
it "uses UnknownRunner if the framework is unknown" do
|
210
210
|
stub_const("UnknownRunner", :unknown_runner)
|
211
|
-
file_queue.stub
|
211
|
+
file_queue.stub(:pop).and_return("file.rb", nil)
|
212
212
|
|
213
213
|
@worker.should_receive(:require_relative).with "unknown_runner"
|
214
214
|
TestRunner.should_receive(:run_file).with("file.rb", UnknownRunner).and_return({})
|
@@ -226,10 +226,10 @@ few lines of output and send it to originator. Order matters" do
|
|
226
226
|
private
|
227
227
|
|
228
228
|
def stub_streams
|
229
|
-
STDIN.stub
|
230
|
-
STDOUT.stub
|
231
|
-
STDERR.stub
|
232
|
-
STDOUT.stub
|
233
|
-
STDERR.stub
|
229
|
+
STDIN.stub(:read).and_return "{}"
|
230
|
+
STDOUT.stub(:reopen)
|
231
|
+
STDERR.stub(:reopen)
|
232
|
+
STDOUT.stub(:sync)
|
233
|
+
STDERR.stub(:sync)
|
234
234
|
end
|
235
235
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorgon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Fitzsimmons
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-05-
|
15
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -360,9 +360,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
360
360
|
version: '0'
|
361
361
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
362
362
|
requirements:
|
363
|
-
- - ! '
|
363
|
+
- - ! '>='
|
364
364
|
- !ruby/object:Gem::Version
|
365
|
-
version:
|
365
|
+
version: '0'
|
366
366
|
requirements: []
|
367
367
|
rubyforge_project: gorgon
|
368
368
|
rubygems_version: 2.1.11
|