cucumber-repeat 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cucumber-repeat.rb +42 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 526b6805f9c8d36bd6804dec4730413878d4e1b1
4
- data.tar.gz: 9739aa448d4895bfa6a4f75320a9603144c10850
3
+ metadata.gz: 21e7bd191223f6a7b89f3ec136d7f39ab584c0a1
4
+ data.tar.gz: bc9c8d04fd3f255c28eded1ca1a7d7aaf058a4d5
5
5
  SHA512:
6
- metadata.gz: a84782ac82b9929a3b7b432e4eda2c37612c2e37c61ec2ee6e004089d0c408abf3e829c668243d18ea383841d5a82b124cdb1fbc3af7d2686eba8b06605cf875
7
- data.tar.gz: 174b603bc73725bde26427cdb870561cd399ae00dc99aa8687282799de9460ab7931ff26df1b7aad1f7e61f150d31f2950355b15855370daeb44a33d2269fb54
6
+ metadata.gz: dc88e6a5d77b8b5469752136278f2902076bd0bbd2523c2d3bbd6b8649ccb64372e52dd9d8eb9707ccd050016f1c2fd5f6c81a0c4eae8b69a289cc9c7ab29e42
7
+ data.tar.gz: 5f723d48777b46ce5fe5b654619df6d0377cd55a8e435754a17f9a1cf43304172003682626d6353437190c7beab1c859a7de58eaf6baf90adcb7eb0b90fe49d6
@@ -1,5 +1,16 @@
1
1
  require 'colorize'
2
2
 
3
+ $coloured_output = true
4
+
5
+ WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
6
+
7
+ if (WINDOWS.nil?) then
8
+ $coloured_output =true
9
+ elsif (!ENV['ANSICON'].nil?) then
10
+ $coloured_output =false
11
+ end
12
+
13
+
3
14
  After('@repeat') do | scenario |
4
15
 
5
16
  if (scenario.failed?)
@@ -20,28 +31,53 @@ end
20
31
 
21
32
 
22
33
  def run_scenario(scenario)
34
+
23
35
  scenario.steps.each do |step_details|
24
36
  if (!scenario.failed?)
25
37
  begin
26
38
  step step_details.name.to_s, step_details.multiline_arg
27
- $stdout.puts " " + step_details.name.strip.green
39
+ $stdout.puts " " + green_text(step_details.name.strip)
28
40
  if (!step_details.multiline_arg.to_s.empty?) then
29
- $stdout.puts " " + step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip.green
41
+ $stdout.puts " " + green_text(step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip)
30
42
  end
31
43
  step_details.status!(:passed)
32
44
  rescue Exception => e
33
- $stdout.puts " " + step_details.name.strip.red
45
+ $stdout.puts " " + red_text(step_details.name.strip)
34
46
  if (!step_details.multiline_arg.to_s.empty?) then
35
- $stdout.puts " " + step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip.red
47
+ $stdout.puts " " + red_text(step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip)
36
48
  end
37
49
  $stdout.puts e.to_s.red
38
50
  step_details.status!(:failed)
39
51
  end
40
52
  else
41
- $stdout.puts " " + step_details.name.strip.yellow
53
+ $stdout.puts " " + yellow_text(step_details.name.strip)
42
54
  if (!step_details.multiline_arg.to_s.empty?) then
43
- $stdout.puts " " + step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip.yellow
55
+ $stdout.puts " " + yellow_text(step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip)
44
56
  end
45
57
  end
46
58
  end
47
59
  end
60
+
61
+ def green_text(text)
62
+
63
+ if ($coloured_output == true) then
64
+ text = text.green
65
+ end
66
+ return text
67
+ end
68
+
69
+ def red_text(text)
70
+
71
+ if ($coloured_output == true) then
72
+ text = text.red
73
+ end
74
+ return text
75
+ end
76
+
77
+ def yellow_text(text)
78
+
79
+ if ($coloured_output == true) then
80
+ text = text.yellow
81
+ end
82
+ return text
83
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-repeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber