multicuke 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/multicuke.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require "multicuke/version"
2
2
  require "multicuke/runner"
3
3
 
4
+ require 'fileutils'
5
+ require 'builder'
6
+ require 'nokogiri'
7
+
4
8
  module Multicuke
5
9
  # Your code goes here...
6
10
  end
@@ -1,6 +1,3 @@
1
- require 'fileutils'
2
- require 'builder'
3
- require 'nokogiri'
4
1
  require 'multicuke/reports_index'
5
2
 
6
3
  module Multicuke
@@ -11,6 +8,10 @@ module Multicuke
11
8
  def run(full_command_as_array)
12
9
  system *full_command_as_array
13
10
  end
11
+
12
+ def exit(status = 0)
13
+ Kernel.exit(status == 0)
14
+ end
14
15
 
15
16
  end
16
17
 
@@ -103,16 +104,19 @@ module Multicuke
103
104
 
104
105
  def start
105
106
  FileUtils.mkdir_p reports_path
106
- launch_process_per_dir
107
+ exit_status = launch_process_per_dir
107
108
  collect_results
108
109
  reports = ReportsIndex.new(reports_path, features_dirs).generate
109
110
  puts "See reports index at #{reports.index_path}" if reports
111
+ system_command.exit(exit_status)
110
112
  end
111
113
 
112
114
  private
113
115
 
114
116
  def launch_process_per_dir
115
- unless dry_run
117
+ if dry_run
118
+ 0
119
+ else
116
120
  features_dirs.each { |features_dir|
117
121
  report_file_path = File.join(reports_path, "#{features_dir.name}.html")
118
122
  feature_full_path = File.join(features_root_path, "#{features_dir.name}")
@@ -130,7 +134,6 @@ module Multicuke
130
134
  pid, status = *process
131
135
  result + status.exitstatus
132
136
  }
133
- exit(global_exit_status == 0)
134
137
  end
135
138
  end
136
139
 
@@ -1,3 +1,3 @@
1
1
  module Multicuke
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/spec/dryrun_spec.rb CHANGED
@@ -4,6 +4,8 @@ module Multicuke
4
4
 
5
5
  describe "Reporting" do
6
6
 
7
+ let(:system_command_stub) { stub('SystemCommand stub').as_null_object }
8
+
7
9
  after(:each) do
8
10
  FileUtils.rm_r(Dir.glob("#{RESULTS_DIR_PATH}/*"), :force => true)
9
11
  end
@@ -14,6 +16,7 @@ module Multicuke
14
16
  r.output_dir_name = "cuke_reports"
15
17
  r.dry_run = true
16
18
  r.output_path = RESULTS_DIR_PATH
19
+ r.system_command = system_command_stub
17
20
  end
18
21
 
19
22
  File.should_not exist("#{RESULTS_DIR_PATH}/cuke_reports")
@@ -39,6 +42,7 @@ module Multicuke
39
42
  r.excluded_dirs = ["exclude_me_features"]
40
43
  r.dry_run = true
41
44
  r.output_path = RESULTS_DIR_PATH
45
+ r.system_command = system_command_stub
42
46
  end
43
47
 
44
48
  runner.start
@@ -56,6 +60,7 @@ module Multicuke
56
60
  r.included_only_dirs = ["addition"]
57
61
  r.dry_run = true
58
62
  r.output_path = RESULTS_DIR_PATH
63
+ r.system_command = system_command_stub
59
64
  end
60
65
 
61
66
  File.should_not exist("#{RESULTS_DIR_PATH}/cucumber_reports")
data/spec/fork_spec.rb CHANGED
@@ -16,7 +16,7 @@ module Multicuke
16
16
  r.output_path = RESULTS_DIR_PATH
17
17
  end
18
18
 
19
- runner.start
19
+ expect{runner.start}.to raise_error SystemExit
20
20
 
21
21
  File.should exist("#{RESULTS_DIR_PATH}/cucumber_reports/addition.html")
22
22
  File.should exist("#{RESULTS_DIR_PATH}/cucumber_reports/division.html")
@@ -11,8 +11,8 @@ describe "System command" do
11
11
  end
12
12
 
13
13
  runner.should_receive(:fork)
14
+ runner.system_command.should_receive(:exit).with(0)
14
15
  runner.start
15
-
16
16
  end
17
17
 
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multicuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-05 00:00:00.000000000 Z
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber