spectus 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ require_relative File.join 'support', 'coverage'
2
+ require_relative File.join '..', 'lib', 'spectus'
3
+
4
+ subject = -> { 'foo'.upcase }
5
+
6
+ begin
7
+ Spectus.this(&subject).MAY(Eql: 'foo')
8
+ rescue Spectus::Result::Fail => raised_result
9
+ raise 'failing test' unless raised_result.to_char == 'F'
10
+ raise 'failing test' unless raised_result.to_h == {
11
+ subject: subject,
12
+ challenge: :call,
13
+ context: [],
14
+ actual: 'FOO',
15
+ expected: { Eql: 'foo' },
16
+ got: false,
17
+ error: nil,
18
+ level: :Low,
19
+ negate: false,
20
+ valid: false,
21
+ result: false
22
+ }
23
+
24
+ print '.'
25
+ end
26
+
27
+ subject = -> { 'foo'.upcase(:bar) }
28
+
29
+ begin
30
+ Spectus.this(&subject).MAY(Eql: 'foo')
31
+ rescue Spectus::Result::Fail => raised_result
32
+ raise 'failing test' unless raised_result.error.class == ArgumentError
33
+ raise 'failing test' unless raised_result.to_char == 'E'
34
+ raise 'failing test' unless raised_result.to_h == {
35
+ subject: subject,
36
+ challenge: :call,
37
+ context: [],
38
+ actual: nil,
39
+ expected: { Eql: 'foo' },
40
+ got: nil,
41
+ error: raised_result.error,
42
+ level: :Low,
43
+ negate: false,
44
+ valid: false,
45
+ result: false
46
+ }
47
+
48
+ print '.'
49
+ end
50
+
51
+ puts
@@ -0,0 +1,47 @@
1
+ require_relative File.join 'support', 'coverage'
2
+ require_relative File.join '..', 'lib', 'spectus'
3
+
4
+ subject = -> { 'foo'.upcase }
5
+
6
+ result = Spectus.this(&subject).MAY(Eql: 'FOO')
7
+
8
+ fail 'failing test' unless result.to_char == '.'
9
+ fail 'failing test' unless result.to_h == {
10
+ subject: subject,
11
+ challenge: :call,
12
+ context: [],
13
+ actual: 'FOO',
14
+ expected: { Eql: 'FOO' },
15
+ got: true,
16
+ error: nil,
17
+ level: :Low,
18
+ negate: false,
19
+ valid: true,
20
+ result: true
21
+ }
22
+
23
+ print '.'
24
+
25
+ subject = -> { 'foo'.bar }
26
+
27
+ result = Spectus.this(&subject).MAY(Eql: 'foo')
28
+
29
+ fail 'failing test' unless result.error.class == NoMethodError
30
+ fail 'failing test' unless result.to_char == 'I'
31
+ fail 'failing test' unless result.to_h == {
32
+ subject: subject,
33
+ challenge: :call,
34
+ context: [],
35
+ actual: nil,
36
+ expected: { Eql: 'foo' },
37
+ got: nil,
38
+ error: result.error,
39
+ level: :Low,
40
+ negate: false,
41
+ valid: false,
42
+ result: true
43
+ }
44
+
45
+ print '.'
46
+
47
+ puts
@@ -0,0 +1,50 @@
1
+ require_relative File.join 'support', 'coverage'
2
+ require_relative File.join '..', 'lib', 'spectus'
3
+
4
+ subject = -> { 'foo'.bar }
5
+
6
+ begin
7
+ Spectus.this(&subject).SHOULD(Eql: 'foo')
8
+ rescue Spectus::Result::Fail => raised_result
9
+ raise 'failing test' unless raised_result.error.class == NoMethodError
10
+ raise 'failing test' unless raised_result.to_char == 'E'
11
+ raise 'failing test' unless raised_result.to_h == {
12
+ subject: subject,
13
+ challenge: :call,
14
+ context: [],
15
+ actual: nil,
16
+ expected: { Eql: 'foo' },
17
+ got: nil,
18
+ error: raised_result.error,
19
+ level: :Medium,
20
+ negate: false,
21
+ valid: false,
22
+ result: false
23
+ }
24
+
25
+ print '.'
26
+ end
27
+
28
+ begin
29
+ Spectus.this(&subject).SHOULD_NOT(Eql: 'foo')
30
+ rescue Spectus::Result::Fail => raised_result
31
+ raise 'failing test' unless raised_result.error.class == NoMethodError
32
+ raise 'failing test' unless raised_result.to_char == 'E'
33
+ raise 'failing test' unless raised_result.to_h == {
34
+ subject: subject,
35
+ challenge: :call,
36
+ context: [],
37
+ actual: nil,
38
+ expected: { Eql: 'foo' },
39
+ got: nil,
40
+ error: raised_result.error,
41
+ level: :Medium,
42
+ negate: true,
43
+ valid: false,
44
+ result: false
45
+ }
46
+
47
+ print '.'
48
+ end
49
+
50
+ puts
@@ -0,0 +1,82 @@
1
+ require_relative File.join 'support', 'coverage'
2
+ require_relative File.join '..', 'lib', 'spectus'
3
+
4
+ subject = -> { 'foo'.upcase }
5
+
6
+ result = Spectus.this(&subject).SHOULD(Eql: 'foo')
7
+
8
+ fail 'failing test' unless result.to_char == 'I'
9
+ fail 'failing test' unless result.to_h == {
10
+ subject: subject,
11
+ challenge: :call,
12
+ context: [],
13
+ actual: 'FOO',
14
+ expected: { Eql: 'foo' },
15
+ got: false,
16
+ error: nil,
17
+ level: :Medium,
18
+ negate: false,
19
+ valid: false,
20
+ result: true
21
+ }
22
+
23
+ print '.'
24
+
25
+ result = Spectus.this(&subject).SHOULD_NOT(Eql: 'foo')
26
+
27
+ fail 'failing test' unless result.to_char == '.'
28
+ fail 'failing test' unless result.to_h == {
29
+ subject: subject,
30
+ challenge: :call,
31
+ context: [],
32
+ actual: 'FOO',
33
+ expected: { Eql: 'foo' },
34
+ got: true,
35
+ error: nil,
36
+ level: :Medium,
37
+ negate: true,
38
+ valid: true,
39
+ result: true
40
+ }
41
+
42
+ print '.'
43
+
44
+ result = Spectus.this(&subject).SHOULD(Eql: 'FOO')
45
+
46
+ fail 'failing test' unless result.to_char == '.'
47
+ fail 'failing test' unless result.to_h == {
48
+ subject: subject,
49
+ challenge: :call,
50
+ context: [],
51
+ actual: 'FOO',
52
+ expected: { Eql: 'FOO' },
53
+ got: true,
54
+ error: nil,
55
+ level: :Medium,
56
+ negate: false,
57
+ valid: true,
58
+ result: true
59
+ }
60
+
61
+ print '.'
62
+
63
+ result = Spectus.this(&subject).SHOULD_NOT(Eql: 'FOO')
64
+
65
+ fail 'failing test' unless result.to_char == 'I'
66
+ fail 'failing test' unless result.to_h == {
67
+ subject: subject,
68
+ challenge: :call,
69
+ context: [],
70
+ actual: 'FOO',
71
+ expected: { Eql: 'FOO' },
72
+ got: false,
73
+ error: nil,
74
+ level: :Medium,
75
+ negate: true,
76
+ valid: false,
77
+ result: true
78
+ }
79
+
80
+ print '.'
81
+
82
+ puts
metadata CHANGED
@@ -1,152 +1,132 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
5
- prerelease:
4
+ version: 2.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Cyril Wack
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURiRENDQWxTZ0F3SUJB
14
- Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREErTVE0d0RBWURWUVFEREFWamVY
15
- SnAKYkRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjNOaGMyaHBkR1V4RXpBUkJn
16
- b0praWFKay9Jc1pBRVpGZ05qYjIwdwpIaGNOTVRRd09USTBNVFV5T1RFMFdo
17
- Y05NVFV3T1RJME1UVXlPVEUwV2pBK01RNHdEQVlEVlFRRERBVmplWEpwCmJE
18
- RVhNQlVHQ2dtU0pvbVQ4aXhrQVJrV0IzTmhjMmhwZEdVeEV6QVJCZ29Ka2lh
19
- SmsvSXNaQUVaRmdOamIyMHcKZ2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJ
20
- QkR3QXdnZ0VLQW9JQkFRRHBvbHJjMFNMcERha2JuR1MvaFBxWApEQnNNOVdL
21
- SXJJaURtcG1kTTBQQlI1dFcxSmFkMC8xN3hHQ1RHd3hLanVsM3pxamZoOXdR
22
- SytOblM0TlV0eFFqCmJyeFFyb1lvdHNWd2FVWE9LdXJ1RHNMOGxmeDgrZHFZ
23
- dldCRTZtdDRHZ3gzbG5hdXNPNUlXUTFiU3BkY1lweXIKbXh1UjZjaDFFNXlT
24
- MytBZFRGTnAxOWl3RnY2RU9ML08waUU3SmI0UkNjZnA0VWEvOVJBbzNHSHor
25
- L2lWa0xqeApIeFZaZi80RjhsdnBDQmFkZzhUc0haVHFRZ3I4RVc2VEhlSGk1
26
- WVhWRnRoM0xIN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Ze3W/Ux7Irtd+JPd8pwuObE8i7h1tepcMWNQWFFmYOmYwmkB46WUTqa3Y
30
+ zeYBFLJQAl0AQPaGujsG5tssIabiNy1ryydKAjWkNDxqLgvtwST3L0Qr9UQFQgoA
31
+ O2Rl8PjSD+2P9XE7T2x1xQ==
32
+ -----END CERTIFICATE-----
33
+ date: 2015-05-19 00:00:00.000000000 Z
42
34
  dependencies:
43
35
  - !ruby/object:Gem::Dependency
44
36
  name: matchi
45
37
  requirement: !ruby/object:Gem::Requirement
46
- none: false
47
38
  requirements:
48
- - - ~>
39
+ - - "~>"
49
40
  - !ruby/object:Gem::Version
50
- version: 0.0.4
41
+ version: 0.0.6
51
42
  type: :runtime
52
43
  prerelease: false
53
44
  version_requirements: !ruby/object:Gem::Requirement
54
- none: false
55
45
  requirements:
56
- - - ~>
46
+ - - "~>"
57
47
  - !ruby/object:Gem::Version
58
- version: 0.0.4
48
+ version: 0.0.6
59
49
  - !ruby/object:Gem::Dependency
60
50
  name: bundler
61
51
  requirement: !ruby/object:Gem::Requirement
62
- none: false
63
52
  requirements:
64
- - - ~>
53
+ - - "~>"
65
54
  - !ruby/object:Gem::Version
66
- version: '1.8'
55
+ version: '1.9'
67
56
  type: :development
68
57
  prerelease: false
69
58
  version_requirements: !ruby/object:Gem::Requirement
70
- none: false
71
59
  requirements:
72
- - - ~>
60
+ - - "~>"
73
61
  - !ruby/object:Gem::Version
74
- version: '1.8'
62
+ version: '1.9'
75
63
  - !ruby/object:Gem::Dependency
76
64
  name: rake
77
65
  requirement: !ruby/object:Gem::Requirement
78
- none: false
79
66
  requirements:
80
- - - ~>
67
+ - - "~>"
81
68
  - !ruby/object:Gem::Version
82
- version: '10.0'
69
+ version: '10.4'
83
70
  type: :development
84
71
  prerelease: false
85
72
  version_requirements: !ruby/object:Gem::Requirement
86
- none: false
87
73
  requirements:
88
- - - ~>
74
+ - - "~>"
89
75
  - !ruby/object:Gem::Version
90
- version: '10.0'
76
+ version: '10.4'
91
77
  - !ruby/object:Gem::Dependency
92
78
  name: yard
93
79
  requirement: !ruby/object:Gem::Requirement
94
- none: false
95
80
  requirements:
96
- - - ~>
81
+ - - "~>"
97
82
  - !ruby/object:Gem::Version
98
83
  version: '0.8'
99
84
  type: :development
100
85
  prerelease: false
101
86
  version_requirements: !ruby/object:Gem::Requirement
102
- none: false
103
87
  requirements:
104
- - - ~>
88
+ - - "~>"
105
89
  - !ruby/object:Gem::Version
106
90
  version: '0.8'
107
91
  - !ruby/object:Gem::Dependency
108
92
  name: simplecov
109
93
  requirement: !ruby/object:Gem::Requirement
110
- none: false
111
94
  requirements:
112
- - - ~>
95
+ - - "~>"
113
96
  - !ruby/object:Gem::Version
114
- version: 0.9.1
97
+ version: '0.10'
115
98
  type: :development
116
99
  prerelease: false
117
100
  version_requirements: !ruby/object:Gem::Requirement
118
- none: false
119
101
  requirements:
120
- - - ~>
102
+ - - "~>"
121
103
  - !ruby/object:Gem::Version
122
- version: 0.9.1
104
+ version: '0.10'
123
105
  - !ruby/object:Gem::Dependency
124
106
  name: rubocop
125
107
  requirement: !ruby/object:Gem::Requirement
126
- none: false
127
108
  requirements:
128
- - - ~>
109
+ - - "~>"
129
110
  - !ruby/object:Gem::Version
130
- version: '0.29'
111
+ version: '0.31'
131
112
  type: :development
132
113
  prerelease: false
133
114
  version_requirements: !ruby/object:Gem::Requirement
134
- none: false
135
115
  requirements:
136
- - - ~>
116
+ - - "~>"
137
117
  - !ruby/object:Gem::Version
138
- version: '0.29'
139
- description: Expectation library with RFC 2119's requirement levels, and some matchers
140
- for Ruby.
118
+ version: '0.31'
119
+ description: Expectation library with RFC 2119's requirement levels.
141
120
  email:
142
121
  - contact@cyril.email
143
122
  executables: []
144
123
  extensions: []
145
124
  extra_rdoc_files: []
146
125
  files:
147
- - .gitignore
148
- - .travis.yml
149
- - .yardopts
126
+ - ".gitignore"
127
+ - ".rubocop.yml"
128
+ - ".travis.yml"
129
+ - ".yardopts"
150
130
  - CODE_OF_CONDUCT.md
151
131
  - Gemfile
152
132
  - LICENSE.md
@@ -156,45 +136,48 @@ files:
156
136
  - bin/console
157
137
  - bin/setup
158
138
  - lib/spectus.rb
139
+ - lib/spectus/challenge.rb
159
140
  - lib/spectus/expectation_target.rb
160
- - lib/spectus/matcher.rb
161
- - lib/spectus/requirement.rb
162
- - lib/spectus/requirement_level/high.rb
163
- - lib/spectus/requirement_level/low.rb
164
- - lib/spectus/requirement_level/medium.rb
141
+ - lib/spectus/level/base.rb
142
+ - lib/spectus/level/high.rb
143
+ - lib/spectus/level/low.rb
144
+ - lib/spectus/level/medium.rb
145
+ - lib/spectus/result/base.rb
146
+ - lib/spectus/result/fail.rb
147
+ - lib/spectus/result/pass.rb
165
148
  - lib/spectus/sandbox.rb
166
149
  - spectus-gem-public_cert.pem
167
150
  - spectus.gemspec
151
+ - test/support/coverage.rb
152
+ - test/test_high_fail.rb
153
+ - test/test_high_pass.rb
154
+ - test/test_low_fail.rb
155
+ - test/test_low_pass.rb
156
+ - test/test_medium_fail.rb
157
+ - test/test_medium_pass.rb
168
158
  homepage: https://github.com/fixrb/spectus
169
159
  licenses:
170
160
  - MIT
161
+ metadata: {}
171
162
  post_install_message:
172
163
  rdoc_options: []
173
164
  require_paths:
174
165
  - lib
175
166
  required_ruby_version: !ruby/object:Gem::Requirement
176
- none: false
177
167
  requirements:
178
- - - ! '>='
168
+ - - ">="
179
169
  - !ruby/object:Gem::Version
180
170
  version: '0'
181
- segments:
182
- - 0
183
- hash: 273438499911024764
184
171
  required_rubygems_version: !ruby/object:Gem::Requirement
185
- none: false
186
172
  requirements:
187
- - - ! '>='
173
+ - - ">="
188
174
  - !ruby/object:Gem::Version
189
175
  version: '0'
190
- segments:
191
- - 0
192
- hash: 273438499911024764
193
176
  requirements: []
194
177
  rubyforge_project:
195
- rubygems_version: 1.8.23.2
178
+ rubygems_version: 2.4.5
196
179
  signing_key:
197
- specification_version: 3
198
- summary: Expectation library with requirement levels.
180
+ specification_version: 4
181
+ summary: Expectation library with RFC 2119 keywords.
199
182
  test_files: []
200
183
  has_rdoc: