fix 0.12.1 → 0.12.2

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: 091c6e53a0b7140971018acc0961627088af153f
4
- data.tar.gz: 35278de525504bd22ee7b0968a6c5af293d19fa1
3
+ metadata.gz: 45838ef872d6a29fda7dd506bdc57195f51bbb40
4
+ data.tar.gz: 7f2df30fee8f7edc98e46b1273b0bc1296753664
5
5
  SHA512:
6
- metadata.gz: 78e7f2d156f17f0b9577e611d908fd2bac7214fadfe20b0fff24cdd641aa30577f00593f47415f3b784e641ba750acb071ce99df187572adb2c521f4f1b2eaa6
7
- data.tar.gz: 5e914f6d797301a3387172c18f4b53d2f84a7357d0fc102da5394528fa62d63d6e88ca473de141bb7a215e5f8a812ecd1dc80244bbd3be7edca364caf50075d7
6
+ metadata.gz: caddf82391e49d19941a2f839d94137479124ba37876ae75aa20d3038fc3ae003f8a46381adce353c4b7fda7bd97cd47bbca81be70166518cbba77c6ef6be8fc
7
+ data.tar.gz: 234696627df5367230d8d20b874e76af040ed9cdf6c2a70403ee7942019d391df81884e3f7e413446b72eb191c171956d10adbe7509e7724e9199b1d72b9fe49
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -49,7 +49,7 @@ And then execute:
49
49
 
50
50
  ### Minimalist
51
51
 
52
- With 148 lines of **simple code** built on top of [Spectus expectation library](https://github.com/fixrb/spectus), facilities such as benchmarking and mocking are not supported. __Fix__ offers however a **consistent** syntax to focus your BDD.
52
+ With 179 lines of **simple code** built on top of [Spectus expectation library](https://github.com/fixrb/spectus), facilities such as benchmarking and mocking are not supported. __Fix__ offers however a **consistent** syntax to focus your BDD.
53
53
 
54
54
  ### Resistant
55
55
 
@@ -1 +1 @@
1
- 0.12.1
1
+ 0.12.2
@@ -0,0 +1 @@
1
+ 3867c77b30709a95156d9910e5be5e87ebdfa2d535c46d776aa0be149e398b660654544d478cdb8353d2ae77c5b258e9db3ef17e7b9326b56d5e5880b7be654b
data/lib/fix.rb CHANGED
@@ -20,7 +20,7 @@ module Fix
20
20
  def self.describe(front_object, options = {}, &specs)
21
21
  t = Test.new(front_object, options, &specs)
22
22
 
23
- puts "#{t.report}" if options.fetch(:verbose, true)
23
+ print "#{t.report}" if options.fetch(:verbose, true)
24
24
  exit t.pass?
25
25
  end
26
26
  end
@@ -13,17 +13,14 @@ module Fix
13
13
 
14
14
  # @!attribute [r] test
15
15
  #
16
- # @return [Test] The result.
16
+ # @return [Test] The results of the test.
17
17
  attr_reader :test
18
18
 
19
19
  # The report in plain text.
20
20
  #
21
21
  # @return [String] The report in plain text.
22
22
  def to_s
23
- maybe_thematic_break +
24
- maybe_alerts_banner +
25
- total_time_banner +
26
- statistics_banner
23
+ maybe_thematic_break + maybe_alerts + total_time + statistics
27
24
  end
28
25
 
29
26
  private
@@ -34,7 +31,7 @@ module Fix
34
31
  end
35
32
 
36
33
  # @private
37
- def total_time_banner
34
+ def total_time
38
35
  "Ran #{test.results.length} tests in #{test.total_time} seconds\n"
39
36
  end
40
37
 
@@ -44,24 +41,27 @@ module Fix
44
41
  end
45
42
 
46
43
  # @private
47
- def maybe_alerts_banner
48
- alerts.any? ? "#{results_banner.join("\n")}\n" : ''
44
+ def maybe_alerts
45
+ alerts.any? ? "#{results.join("\n")}\n" : ''
49
46
  end
50
47
 
51
48
  # @private
52
- def results_banner
49
+ def results
53
50
  alerts.map.with_index(1) do |r, i|
54
- s = "#{i}. #{r.message}\n" + maybe_backtrace(r)
51
+ maybe_results_color("#{i}. #{r.message}\n" + maybe_backtrace(r), r)
52
+ end
53
+ end
55
54
 
56
- next s unless @test.configuration.fetch(:color)
55
+ # @private
56
+ def maybe_results_color(string, result)
57
+ return string unless @test.configuration.fetch(:color)
57
58
 
58
- if r.to_sym.equal?(:info)
59
- "\e[33m#{s}\e[0m"
60
- elsif r.to_sym.equal?(:failure)
61
- "\e[35m#{s}\e[0m"
62
- else
63
- "\e[31m#{s}\e[0m"
64
- end
59
+ if result.to_sym.equal?(:info)
60
+ "\e[#{info_color}m#{string}\e[0m"
61
+ elsif result.to_sym.equal?(:failure)
62
+ "\e[#{failure_color}m#{string}\e[0m"
63
+ else
64
+ "\e[#{error_color}m#{string}\e[0m"
65
65
  end
66
66
  end
67
67
 
@@ -71,25 +71,53 @@ module Fix
71
71
  end
72
72
 
73
73
  # @private
74
- def statistics_banner
75
- s = "#{test.statistics.fetch(:pass_percent)}% compliant - " \
76
- "#{test.statistics.fetch(:total_infos)} infos, " \
77
- "#{test.statistics.fetch(:total_failures)} failures, " \
78
- "#{test.statistics.fetch(:total_errors)} errors"
79
-
80
- return s unless @test.configuration.fetch(:color)
74
+ def statistics
75
+ if @test.configuration.fetch(:color)
76
+ statistics_color(statistics_text, test.statistics)
77
+ else
78
+ statistics_text
79
+ end
80
+ end
81
81
 
82
- stats = test.statistics
82
+ # @private
83
+ def statistics_text
84
+ "#{test.statistics.fetch(:pass_percent)}% compliant - " \
85
+ "#{test.statistics.fetch(:total_infos)} infos, " \
86
+ "#{test.statistics.fetch(:total_failures)} failures, " \
87
+ "#{test.statistics.fetch(:total_errors)} errors\n"
88
+ end
83
89
 
90
+ # @private
91
+ def statistics_color(string, stats)
84
92
  if stats.fetch(:total_errors) > 0
85
- "\e[31m#{s}\e[0m"
93
+ "\e[#{error_color}m#{string}\e[0m"
86
94
  elsif stats.fetch(:total_failures) > 0
87
- "\e[35m#{s}\e[0m"
95
+ "\e[#{failure_color}m#{string}\e[0m"
88
96
  elsif stats.fetch(:total_infos) > 0
89
- "\e[33m#{s}\e[0m"
97
+ "\e[#{info_color}m#{string}\e[0m"
90
98
  else
91
- "\e[32m#{s}\e[0m"
99
+ "\e[#{success_color}m#{string}\e[0m"
92
100
  end
93
101
  end
102
+
103
+ # @private
104
+ def error_color
105
+ 31
106
+ end
107
+
108
+ # @private
109
+ def failure_color
110
+ 35
111
+ end
112
+
113
+ # @private
114
+ def info_color
115
+ 33
116
+ end
117
+
118
+ # @private
119
+ def success_color
120
+ 32
121
+ end
94
122
  end
95
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Wack
@@ -30,7 +30,7 @@ cert_chain:
30
30
  dzJvWzQ1+dJU6WQv75E9ddSkaQrK3nhdgQVu+/wgvGSrsMvOGNz+LXaSDxQqZuwX
31
31
  0KNQFuIukfrdk8URwRnHoAnvx4U93iUw
32
32
  -----END CERTIFICATE-----
33
- date: 2015-09-19 00:00:00.000000000 Z
33
+ date: 2015-09-20 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: defi
@@ -138,7 +138,6 @@ extensions: []
138
138
  extra_rdoc_files: []
139
139
  files:
140
140
  - ".gitignore"
141
- - ".rubocop.yml"
142
141
  - ".travis.yml"
143
142
  - ".yardopts"
144
143
  - CODE_OF_CONDUCT.md
@@ -157,6 +156,7 @@ files:
157
156
  - checksum/fix-0.11.0.gem.sha512
158
157
  - checksum/fix-0.11.1.gem.sha512
159
158
  - checksum/fix-0.12.0.gem.sha512
159
+ - checksum/fix-0.12.1.gem.sha512
160
160
  - checksum/fix-0.2.0.gem.sha512
161
161
  - checksum/fix-0.3.0.gem.sha512
162
162
  - checksum/fix-0.4.0.gem.sha512
metadata.gz.sig CHANGED
Binary file
@@ -1,12 +0,0 @@
1
- TrivialAccessors:
2
- Enabled: true
3
- ExactNameMatch: true
4
-
5
- Style/MethodName:
6
- Enabled: false
7
-
8
- ParameterLists:
9
- Max: 11
10
-
11
- Metrics/MethodLength:
12
- Max: 16