spectus 3.0.9 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +1 -1
  3. data/README.md +67 -84
  4. data/lib/spectus.rb +3 -5
  5. data/lib/spectus/exam.rb +56 -0
  6. data/lib/spectus/expectation_target.rb +87 -70
  7. data/lib/spectus/requirement_level/base.rb +50 -75
  8. data/lib/spectus/requirement_level/may.rb +17 -0
  9. data/lib/spectus/requirement_level/must.rb +17 -0
  10. data/lib/spectus/requirement_level/should.rb +17 -0
  11. data/lib/spectus/result/common.rb +174 -0
  12. data/lib/spectus/result/fail.rb +40 -17
  13. data/lib/spectus/result/pass.rb +48 -21
  14. metadata +87 -91
  15. data/.gitignore +0 -11
  16. data/.rubocop.yml +0 -1
  17. data/.rubocop_todo.yml +0 -56
  18. data/.travis.yml +0 -28
  19. data/.yardopts +0 -1
  20. data/CODE_OF_CONDUCT.md +0 -13
  21. data/Gemfile +0 -5
  22. data/Rakefile +0 -23
  23. data/VERSION.semver +0 -1
  24. data/bin/console +0 -8
  25. data/bin/setup +0 -6
  26. data/checksum/spectus-2.0.0.gem.sha512 +0 -1
  27. data/checksum/spectus-2.0.1.gem.sha512 +0 -1
  28. data/checksum/spectus-2.0.2.gem.sha512 +0 -1
  29. data/checksum/spectus-2.0.3.gem.sha512 +0 -1
  30. data/checksum/spectus-2.0.4.gem.sha512 +0 -1
  31. data/checksum/spectus-2.1.0.gem.sha512 +0 -1
  32. data/checksum/spectus-2.1.1.gem.sha512 +0 -1
  33. data/checksum/spectus-2.1.2.gem.sha512 +0 -1
  34. data/checksum/spectus-2.1.3.gem.sha512 +0 -1
  35. data/checksum/spectus-2.10.0.gem.sha512 +0 -1
  36. data/checksum/spectus-2.2.0.gem.sha512 +0 -1
  37. data/checksum/spectus-2.3.0.gem.sha512 +0 -1
  38. data/checksum/spectus-2.3.1.gem.sha512 +0 -1
  39. data/checksum/spectus-2.4.0.gem.sha512 +0 -1
  40. data/checksum/spectus-2.5.0.gem.sha512 +0 -1
  41. data/checksum/spectus-2.6.0.gem.sha512 +0 -1
  42. data/checksum/spectus-2.7.0.gem.sha512 +0 -1
  43. data/checksum/spectus-2.7.1.gem.sha512 +0 -1
  44. data/checksum/spectus-2.8.0.gem.sha512 +0 -1
  45. data/checksum/spectus-2.9.0.gem.sha512 +0 -1
  46. data/checksum/spectus-2.9.1.gem.sha512 +0 -1
  47. data/checksum/spectus-2.9.2.gem.sha512 +0 -1
  48. data/checksum/spectus-3.0.0.gem.sha512 +0 -1
  49. data/checksum/spectus-3.0.1.gem.sha512 +0 -1
  50. data/checksum/spectus-3.0.2.gem.sha512 +0 -1
  51. data/checksum/spectus-3.0.3.gem.sha512 +0 -1
  52. data/checksum/spectus-3.0.5.gem.sha512 +0 -1
  53. data/checksum/spectus-3.0.6.gem.sha512 +0 -1
  54. data/checksum/spectus-3.0.7.gem.sha512 +0 -1
  55. data/checksum/spectus-3.0.8.gem.sha512 +0 -1
  56. data/lib/spectus/matchers.rb +0 -33
  57. data/lib/spectus/report.rb +0 -92
  58. data/lib/spectus/requirement_level/high.rb +0 -27
  59. data/lib/spectus/requirement_level/low.rb +0 -27
  60. data/lib/spectus/requirement_level/medium.rb +0 -27
  61. data/lib/spectus/result/base.rb +0 -112
  62. data/lib/spectus/sandbox.rb +0 -61
  63. data/pkg_checksum +0 -12
  64. data/spectus.gemspec +0 -28
@@ -1,56 +1,83 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
3
+ require_relative "common"
4
4
 
5
5
  module Spectus
6
6
  module Result
7
7
  # The class that is responsible for reporting that the expectation is true.
8
8
  class Pass
9
- include Base
9
+ include Common
10
10
 
11
- # @!attribute [r] message
11
+ alias message to_s
12
+
13
+ # Did the test fail?
12
14
  #
13
- # @return [String] The message that describe the state.
14
- attr_reader :message
15
+ # @return [Boolean] The spec passed or failed?
16
+ def failed?
17
+ false
18
+ end
15
19
 
16
- # The value of the expectation of the spec.
20
+ # Did the test pass?
17
21
  #
18
- # @return [Boolean] The spec was true.
19
- def result?
20
- true
22
+ # @return [Boolean] The spec passed or failed?
23
+ def passed?
24
+ !failed?
21
25
  end
22
26
 
23
- # The state of success.
27
+ # The state of failure.
24
28
  #
25
- # @return [Boolean] The test was a success.
26
- def success?
27
- got.equal?(true)
29
+ # @return [Boolean] The test was a failure?
30
+ def failure?
31
+ false
28
32
  end
29
33
 
30
34
  # The state of info.
31
35
  #
32
- # @return [Boolean] The test was an info.
36
+ # @return [Boolean] The test was an info?
33
37
  def info?
34
- !success?
38
+ !error.nil?
39
+ end
40
+
41
+ # The state of warning.
42
+ #
43
+ # @return [Boolean] The test was a warning?
44
+ def warning?
45
+ got.equal?(false)
35
46
  end
36
47
 
37
48
  # Identify the state of the result.
38
49
  #
39
50
  # @return [Symbol] The identifier of the state.
40
51
  def to_sym
41
- success? ? :success : :info
52
+ return :success if success?
53
+ return :warning if warning?
54
+
55
+ :info
42
56
  end
43
57
 
44
58
  # Express the result with one char.
45
59
  #
46
- # @param color [Boolean] Enable the color.
47
- #
48
60
  # @return [String] The char that identify the result.
49
- def to_char(color = false)
61
+ def char
62
+ if success?
63
+ "."
64
+ elsif warning?
65
+ "W"
66
+ else
67
+ "I"
68
+ end
69
+ end
70
+
71
+ # Express the result with one emoji.
72
+ #
73
+ # @return [String] The emoji that identify the result.
74
+ def emoji
50
75
  if success?
51
- color ? "\e[32m.\e[0m" : '.'
76
+ ""
77
+ elsif warning?
78
+ "⚠️"
52
79
  else
53
- color ? "\e[33mI\e[0m" : 'I'
80
+ "💡"
54
81
  end
55
82
  end
56
83
  end
metadata CHANGED
@@ -1,191 +1,187 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aw
14
+ name: defi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.6
19
+ version: 2.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.6
26
+ version: 2.0.4
27
27
  - !ruby/object:Gem::Dependency
28
- name: defi
28
+ name: matchi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.5
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.5
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: matchi
42
+ name: brutal
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.4
48
- type: :runtime
47
+ version: '0'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.4
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '13.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '13.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: rubocop-md
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0.75'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-performance
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '0.75'
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-thread_safety
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: simplecov
99
141
  requirement: !ruby/object:Gem::Requirement
100
142
  requirements:
101
- - - "~>"
143
+ - - ">="
102
144
  - !ruby/object:Gem::Version
103
- version: '0.17'
145
+ version: '0'
104
146
  type: :development
105
147
  prerelease: false
106
148
  version_requirements: !ruby/object:Gem::Requirement
107
149
  requirements:
108
- - - "~>"
150
+ - - ">="
109
151
  - !ruby/object:Gem::Version
110
- version: '0.17'
152
+ version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: yard
113
155
  requirement: !ruby/object:Gem::Requirement
114
156
  requirements:
115
- - - "~>"
157
+ - - ">="
116
158
  - !ruby/object:Gem::Version
117
- version: '0.9'
159
+ version: '0'
118
160
  type: :development
119
161
  prerelease: false
120
162
  version_requirements: !ruby/object:Gem::Requirement
121
163
  requirements:
122
- - - "~>"
164
+ - - ">="
123
165
  - !ruby/object:Gem::Version
124
- version: '0.9'
125
- description: Expectation library with RFC 2119's requirement levels.
126
- email:
127
- - contact@cyril.email
166
+ version: '0'
167
+ description: "Expectation library with RFC 2119's requirement levels \U0001F6A5"
168
+ email: contact@cyril.email
128
169
  executables: []
129
170
  extensions: []
130
171
  extra_rdoc_files: []
131
172
  files:
132
- - ".gitignore"
133
- - ".rubocop.yml"
134
- - ".rubocop_todo.yml"
135
- - ".travis.yml"
136
- - ".yardopts"
137
- - CODE_OF_CONDUCT.md
138
- - Gemfile
139
173
  - LICENSE.md
140
174
  - README.md
141
- - Rakefile
142
- - VERSION.semver
143
- - bin/console
144
- - bin/setup
145
- - checksum/spectus-2.0.0.gem.sha512
146
- - checksum/spectus-2.0.1.gem.sha512
147
- - checksum/spectus-2.0.2.gem.sha512
148
- - checksum/spectus-2.0.3.gem.sha512
149
- - checksum/spectus-2.0.4.gem.sha512
150
- - checksum/spectus-2.1.0.gem.sha512
151
- - checksum/spectus-2.1.1.gem.sha512
152
- - checksum/spectus-2.1.2.gem.sha512
153
- - checksum/spectus-2.1.3.gem.sha512
154
- - checksum/spectus-2.10.0.gem.sha512
155
- - checksum/spectus-2.2.0.gem.sha512
156
- - checksum/spectus-2.3.0.gem.sha512
157
- - checksum/spectus-2.3.1.gem.sha512
158
- - checksum/spectus-2.4.0.gem.sha512
159
- - checksum/spectus-2.5.0.gem.sha512
160
- - checksum/spectus-2.6.0.gem.sha512
161
- - checksum/spectus-2.7.0.gem.sha512
162
- - checksum/spectus-2.7.1.gem.sha512
163
- - checksum/spectus-2.8.0.gem.sha512
164
- - checksum/spectus-2.9.0.gem.sha512
165
- - checksum/spectus-2.9.1.gem.sha512
166
- - checksum/spectus-2.9.2.gem.sha512
167
- - checksum/spectus-3.0.0.gem.sha512
168
- - checksum/spectus-3.0.1.gem.sha512
169
- - checksum/spectus-3.0.2.gem.sha512
170
- - checksum/spectus-3.0.3.gem.sha512
171
- - checksum/spectus-3.0.5.gem.sha512
172
- - checksum/spectus-3.0.6.gem.sha512
173
- - checksum/spectus-3.0.7.gem.sha512
174
- - checksum/spectus-3.0.8.gem.sha512
175
175
  - lib/spectus.rb
176
+ - lib/spectus/exam.rb
176
177
  - lib/spectus/expectation_target.rb
177
- - lib/spectus/matchers.rb
178
- - lib/spectus/report.rb
179
178
  - lib/spectus/requirement_level/base.rb
180
- - lib/spectus/requirement_level/high.rb
181
- - lib/spectus/requirement_level/low.rb
182
- - lib/spectus/requirement_level/medium.rb
183
- - lib/spectus/result/base.rb
179
+ - lib/spectus/requirement_level/may.rb
180
+ - lib/spectus/requirement_level/must.rb
181
+ - lib/spectus/requirement_level/should.rb
182
+ - lib/spectus/result/common.rb
184
183
  - lib/spectus/result/fail.rb
185
184
  - lib/spectus/result/pass.rb
186
- - lib/spectus/sandbox.rb
187
- - pkg_checksum
188
- - spectus.gemspec
189
185
  homepage: https://github.com/fixrb/spectus
190
186
  licenses:
191
187
  - MIT
@@ -198,15 +194,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
194
  requirements:
199
195
  - - ">="
200
196
  - !ruby/object:Gem::Version
201
- version: '0'
197
+ version: 2.7.0
202
198
  required_rubygems_version: !ruby/object:Gem::Requirement
203
199
  requirements:
204
200
  - - ">="
205
201
  - !ruby/object:Gem::Version
206
202
  version: '0'
207
203
  requirements: []
208
- rubygems_version: 3.0.3
204
+ rubygems_version: 3.1.4
209
205
  signing_key:
210
206
  specification_version: 4
211
- summary: Expectation library with RFC 2119 keywords.
207
+ summary: "Expectation library with RFC 2119's requirement levels \U0001F6A5"
212
208
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.ruby-version
3
- /.yardoc
4
- /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
11
- .DS_Store
data/.rubocop.yml DELETED
@@ -1 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml DELETED
@@ -1,56 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2019-10-08 23:18:40 +0200 using RuboCop version 0.75.0.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 230
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
12
- # SupportedHashRocketStyles: key, separator, table
13
- # SupportedColonStyles: key, separator, table
14
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
15
- Layout/AlignHash:
16
- Exclude:
17
- - 'lib/spectus/result/base.rb'
18
- - 'test/level/test_high_fail.rb'
19
- - 'test/level/test_high_pass.rb'
20
- - 'test/level/test_low_fail.rb'
21
- - 'test/level/test_low_pass.rb'
22
- - 'test/level/test_medium_fail.rb'
23
- - 'test/level/test_medium_pass.rb'
24
- - 'test/test_with_isolation.rb'
25
- - 'test/test_without_isolation.rb'
26
-
27
- # Offense count: 2
28
- # Configuration parameters: CountComments, ExcludedMethods.
29
- Metrics/MethodLength:
30
- Max: 12
31
-
32
- # Offense count: 1
33
- # Configuration parameters: CountKeywordArgs.
34
- Metrics/ParameterLists:
35
- Max: 10
36
-
37
- # Offense count: 10
38
- # Cop supports --auto-correct.
39
- # Configuration parameters: PreferredName.
40
- Naming/RescuedExceptionsVariableName:
41
- Exclude:
42
- - 'test/level/test_high_fail.rb'
43
- - 'test/level/test_low_fail.rb'
44
- - 'test/level/test_medium_fail.rb'
45
-
46
- # Offense count: 8
47
- Style/MixinUsage:
48
- Exclude:
49
- - 'test/level/test_high_fail.rb'
50
- - 'test/level/test_high_pass.rb'
51
- - 'test/level/test_low_fail.rb'
52
- - 'test/level/test_low_pass.rb'
53
- - 'test/level/test_medium_fail.rb'
54
- - 'test/level/test_medium_pass.rb'
55
- - 'test/test_with_isolation.rb'
56
- - 'test/test_without_isolation.rb'