cukeforker 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4c1ca379107e406de49b6c9c7a8ee9a7c155c43
4
- data.tar.gz: 4048ab9a0dd8a85ea3354d303b4f71d100f27251
3
+ metadata.gz: 78d586215f5f03a4e562c4b6f2242b5c2344472a
4
+ data.tar.gz: d069baca9ebfa3407a0c1cae3e228a88187c9f6d
5
5
  SHA512:
6
- metadata.gz: 461c96e056686d416c4add4dcbd268d99dfc164d158fcbe4cf20e6c822ea92ef97a73617f1b21aee5b19bf18bbfe6eaac73d2be2894569820826f5add6dbbdf6
7
- data.tar.gz: c947910a873f8879e4b9c2879f23d275d7e332bcb5e8950153bfd46990f67d909676378bc80b8880faa63a06cf0f0b069ddae29d759c0c46dd11ff3106dc3d0e
6
+ metadata.gz: f8e4e3e6120d1480015688cde65aaae0f4e25fb737f71cb0a9fab615095d88ef45b33d5dcb450727d60f3b57413755a80a29600fd687986c4a58a489416b3710
7
+ data.tar.gz: 0aa754f8b2c5cd510f4e72520df6bd1a6e8d2557887989159aef49becda1f4eb0cc97ff24ef1000f45e639574c150a4a6048109b8cf2fbaabedb3ea59b70c0d6
@@ -1,4 +1,5 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
4
- - 2.0.0
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - 2.2.0
@@ -6,4 +6,8 @@ split = ARGV.index("--")
6
6
  extra_args = ARGV[0..(split-1)]
7
7
  features = ARGV[(split+1)..-1]
8
8
 
9
- CukeForker::Runner.run(features, :extra_args => extra_args)
9
+ if CukeForker::Runner.run(features, :extra_args => extra_args)
10
+ exit 0
11
+ else
12
+ exit 1
13
+ end
@@ -0,0 +1,43 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ module CukeForker
5
+ class RakeTask < Rake::TaskLib
6
+ attr_accessor :name
7
+ attr_accessor :verbose
8
+ attr_accessor :features
9
+ attr_accessor :extra_args
10
+
11
+ def initialize(*args, &task_block)
12
+ setup_ivars(args)
13
+
14
+ desc 'Run CukeForker' unless ::Rake.application.last_comment
15
+
16
+ task(name, *args) do |_, task_args|
17
+ RakeFileUtils.send(:verbose, verbose) do
18
+ if task_block
19
+ task_block.call(*[self, task_args].slice(0, task_block.arity))
20
+ end
21
+
22
+ run_cukeforker
23
+ end
24
+ end
25
+ end
26
+
27
+ def setup_ivars(args)
28
+ @name = args.shift || :cukeforker
29
+
30
+ split = args.index("--")
31
+ if split
32
+ @extra_args = args[0..(split-1)]
33
+ @features = args[(split+1)..-1]
34
+ end
35
+ end
36
+
37
+ def run_cukeforker
38
+ unless CukeForker::Runner.run(@features, :extra_args => @extra_args)
39
+ raise 'Test failures'
40
+ end
41
+ end
42
+ end
43
+ end
@@ -99,9 +99,11 @@ module CukeForker
99
99
  start
100
100
  process
101
101
  stop
102
+ !@queue.has_failures?
102
103
  rescue Interrupt
103
104
  fire :on_run_interrupted
104
105
  stop
106
+ false
105
107
  rescue StandardError
106
108
  fire :on_run_interrupted
107
109
  stop
@@ -1,3 +1,3 @@
1
1
  module CukeForker
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ require 'cukeforker/rake_task'
4
+
5
+ describe CukeForker::RakeTask do
6
+ describe 'define task' do
7
+ it 'creates a cukeforker task' do
8
+ CukeForker::RakeTask.new
9
+
10
+ expect(Rake::Task.task_defined?(:cukeforker)).to be true
11
+ end
12
+
13
+ it 'creates a named task' do
14
+ CukeForker::RakeTask.new(:run_feature)
15
+
16
+ expect(Rake::Task.task_defined?(:run_feature)).to be true
17
+ end
18
+ end
19
+
20
+ describe 'running task' do
21
+ before(:each) do
22
+ Rake::Task['cukeforker'].clear if Rake::Task.task_defined?('cukeforker')
23
+ end
24
+
25
+ it 'runs specific features' do
26
+ CukeForker::RakeTask.new do |task|
27
+ task.features = ['file1, file2']
28
+ task.verbose = false
29
+ end
30
+
31
+ expect(CukeForker::Runner).to receive(:run).and_return(true)
32
+
33
+ Rake::Task['cukeforker'].execute
34
+ end
35
+
36
+ it 'exits with a non zero status if any tests fail' do
37
+ CukeForker::RakeTask.new do |task|
38
+ task.features = ['file1, file2']
39
+ task.verbose = false
40
+ end
41
+
42
+ expect(CukeForker::Runner).to receive(:run).and_return(false)
43
+
44
+ expect { Rake::Task['cukeforker'].execute }.to raise_error(Exception)
45
+ end
46
+ end
47
+ end
@@ -126,5 +126,25 @@ module CukeForker
126
126
  end
127
127
  end
128
128
 
129
+ context 'exit status' do
130
+ let(:queue) { double(Queue) }
131
+ let(:runner) { Runner.new(queue) }
132
+
133
+ it 'returns true when there are no test failures' do
134
+ queue.stub(:has_failures? => false)
135
+ queue.should_receive(:process).with 0.2 # poll interval
136
+ queue.should_receive(:wait_until_finished)
137
+
138
+ expect(runner.run).to be_true
139
+ end
140
+
141
+ it 'returns false when there are test failures' do
142
+ queue.stub(:has_failures? => true)
143
+ queue.should_receive(:process).with 0.2 # poll interval
144
+ queue.should_receive(:wait_until_finished)
145
+
146
+ expect(runner.run).to be_false
147
+ end
148
+ end
129
149
  end # Runner
130
150
  end # CukeForker
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukeforker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-01 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -103,6 +103,7 @@ files:
103
103
  - lib/cukeforker/formatters/junit_scenario_formatter.rb
104
104
  - lib/cukeforker/formatters/scenario_line_logger.rb
105
105
  - lib/cukeforker/logging_listener.rb
106
+ - lib/cukeforker/rake_task.rb
106
107
  - lib/cukeforker/recording_vnc_listener.rb
107
108
  - lib/cukeforker/runner.rb
108
109
  - lib/cukeforker/scenarios.rb
@@ -112,6 +113,7 @@ files:
112
113
  - lib/cukeforker/worker_queue.rb
113
114
  - spec/cukeforker/formatters/scenario_line_logger_spec.rb
114
115
  - spec/cukeforker/logging_listener_spec.rb
116
+ - spec/cukeforker/rake_task_spec.rb
115
117
  - spec/cukeforker/recording_vnc_listener_spec.rb
116
118
  - spec/cukeforker/runner_spec.rb
117
119
  - spec/cukeforker/scenarios_spec.rb
@@ -145,6 +147,7 @@ summary: Library to maintain a forking queue of Cucumber processes
145
147
  test_files:
146
148
  - spec/cukeforker/formatters/scenario_line_logger_spec.rb
147
149
  - spec/cukeforker/logging_listener_spec.rb
150
+ - spec/cukeforker/rake_task_spec.rb
148
151
  - spec/cukeforker/recording_vnc_listener_spec.rb
149
152
  - spec/cukeforker/runner_spec.rb
150
153
  - spec/cukeforker/scenarios_spec.rb