starting_blocks 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,20 +5,40 @@ module StartingBlocks
5
5
  class GreenOnSuccessRedOnFailure
6
6
 
7
7
  def receive_specs_to_run specs
8
- Blinky.new.light.building!
8
+ @spec_count = specs.count
9
+ return if specs.count == 0
10
+ change_color_to :yellow
9
11
  end
10
12
 
11
13
  def receive_results results
12
- if (results[:errors] || 0) > 0
13
- Blinky.new.light.failure!
14
+ return if @spec_count == 0
15
+ if (results[:tests] || 0) == 0
16
+ change_color_to :red
17
+ elsif (results[:errors] || 0) > 0
18
+ change_color_to :red
14
19
  elsif (results[:failures] || 0) > 0
15
- Blinky.new.light.failure!
20
+ change_color_to :red
16
21
  elsif (results[:skips] || 0) > 0
17
- Blinky.new.light.building!
22
+ change_color_to :yellow
18
23
  else
24
+ change_color_to :green
25
+ end
26
+ end
27
+
28
+ def change_color_to(color)
29
+ case color
30
+ when :green
19
31
  Blinky.new.light.success!
32
+ when :red
33
+ Blinky.new.light.failure!
34
+ when :yellow
35
+ Blinky.new.light.building!
20
36
  end
21
37
  end
22
38
  end
23
39
  end
24
40
  end
41
+
42
+ at_exit do
43
+ Blinky.new.light.off!
44
+ end
@@ -1,3 +1,3 @@
1
1
  module StartingBlocks
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starting_blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
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-29 00:00:00.000000000 Z
12
+ date: 2013-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: -3830665952268180063
167
+ hash: -2284610859489121874
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: -3830665952268180063
176
+ hash: -2284610859489121874
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24