spectus 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/README.md +9 -0
- data/VERSION.semver +1 -1
- data/lib/spectus/expectation_target.rb +2 -0
- data/lib/spectus/matcher.rb +20 -0
- data/lib/spectus/requirement.rb +1 -1
- data/lib/spectus/requirement_level/high.rb +1 -1
- data/lib/spectus/requirement_level/low.rb +1 -1
- data/lib/spectus/requirement_level/medium.rb +1 -1
- data/lib/spectus/sandbox.rb +8 -8
- data/spectus.gemspec +1 -1
- metadata +73 -45
- metadata.gz.sig +2 -2
- checksums.yaml +0 -7
- checksums.yaml.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -36,6 +36,15 @@ Or install it yourself as:
|
|
36
36
|
|
37
37
|
$ gem install spectus
|
38
38
|
|
39
|
+
## Results
|
40
|
+
|
41
|
+
| Requirement levels | **MUST** | **SHOULD** | **MAY** |
|
42
|
+
| ------------------------- | -------- | ---------- | ------- |
|
43
|
+
| Implemented & Matched | `true` | `true` | `true` |
|
44
|
+
| Implemented & Not matched | `false` | `true` | `false` |
|
45
|
+
| Implemented & Exception | `false` | `false` | `false` |
|
46
|
+
| Not implemented | `false` | `false` | `true` |
|
47
|
+
|
39
48
|
## Usage
|
40
49
|
|
41
50
|
**Absolute requirement** definition:
|
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'matchi'
|
2
|
+
|
3
|
+
module Spectus
|
4
|
+
# This module provides matchers to define expectations.
|
5
|
+
module Matcher
|
6
|
+
# Evaluate the expectation with the passed block.
|
7
|
+
#
|
8
|
+
# @param [Hash, Symbol] definition
|
9
|
+
#
|
10
|
+
# @return [Boolean] report if the expectation is true or false
|
11
|
+
def self.pass?(definition, &actual)
|
12
|
+
params = Array(definition).flatten(1)
|
13
|
+
name = params.first.to_s.split('_').map(&:capitalize).join.to_sym
|
14
|
+
expected_args = params[1..-1]
|
15
|
+
matcher = Matchi.const_get(name).new(*expected_args)
|
16
|
+
|
17
|
+
matcher.matches?(&actual)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/spectus/requirement.rb
CHANGED
data/lib/spectus/sandbox.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'matcher'
|
2
2
|
|
3
3
|
module Spectus
|
4
4
|
# This class evaluate the expectation with the passed block.
|
@@ -11,22 +11,22 @@ module Spectus
|
|
11
11
|
# Execute the untested code from the passed block against the definition.
|
12
12
|
#
|
13
13
|
# @param [Hash] definition
|
14
|
-
|
15
|
-
|
14
|
+
# @param [Boolean] negate
|
15
|
+
# @yieldparam actual the value which is compared with the expected value.
|
16
|
+
def initialize(definition, negate, &actual)
|
17
|
+
@got = negate ^ Matcher.pass?(definition, &actual)
|
16
18
|
rescue => e
|
17
19
|
@exception = e
|
18
20
|
end
|
19
21
|
|
20
|
-
# Return the result
|
21
|
-
#
|
22
|
-
# @param [Boolean] negate
|
22
|
+
# Return the result.
|
23
23
|
#
|
24
24
|
# @return [Boolean] Report if the test was true or false.
|
25
|
-
def pass?
|
25
|
+
def pass?
|
26
26
|
if defined?(@exception)
|
27
27
|
false
|
28
28
|
else
|
29
|
-
|
29
|
+
@got
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/spectus.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
|
15
15
|
spec.require_paths = ['lib']
|
16
16
|
|
17
|
-
spec.add_dependency '
|
17
|
+
spec.add_dependency 'matchi', '~> 0.0.4'
|
18
18
|
|
19
19
|
spec.add_development_dependency 'bundler', '~> 1.8'
|
20
20
|
spec.add_development_dependency 'rake', '~> 10.0'
|
metadata
CHANGED
@@ -1,119 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Cyril Wack
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain:
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURiRENDQWxTZ0F3SUJB
|
14
|
+
Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREErTVE0d0RBWURWUVFEREFWamVY
|
15
|
+
SnAKYkRFWE1CVUdDZ21TSm9tVDhpeGtBUmtXQjNOaGMyaHBkR1V4RXpBUkJn
|
16
|
+
b0praWFKay9Jc1pBRVpGZ05qYjIwdwpIaGNOTVRRd09USTBNVFV5T1RFMFdo
|
17
|
+
Y05NVFV3T1RJME1UVXlPVEUwV2pBK01RNHdEQVlEVlFRRERBVmplWEpwCmJE
|
18
|
+
RVhNQlVHQ2dtU0pvbVQ4aXhrQVJrV0IzTmhjMmhwZEdVeEV6QVJCZ29Ka2lh
|
19
|
+
SmsvSXNaQUVaRmdOamIyMHcKZ2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJ
|
20
|
+
QkR3QXdnZ0VLQW9JQkFRRHBvbHJjMFNMcERha2JuR1MvaFBxWApEQnNNOVdL
|
21
|
+
SXJJaURtcG1kTTBQQlI1dFcxSmFkMC8xN3hHQ1RHd3hLanVsM3pxamZoOXdR
|
22
|
+
SytOblM0TlV0eFFqCmJyeFFyb1lvdHNWd2FVWE9LdXJ1R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d21rQjQ2
|
38
|
+
V1VUcWEzWQp6ZVlCRkxKUUFsMEFRUGFHdWpzRzV0c3NJYWJpTnkxcnl5ZEtB
|
39
|
+
aldrTkR4cUxndnR3U1QzTDBRcjlVUUZRZ29BCk8yUmw4UGpTRCsyUDlYRTdU
|
40
|
+
MngxeFE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
41
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
34
42
|
dependencies:
|
35
43
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
44
|
+
name: matchi
|
37
45
|
requirement: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
38
47
|
requirements:
|
39
|
-
- -
|
48
|
+
- - ~>
|
40
49
|
- !ruby/object:Gem::Version
|
41
50
|
version: 0.0.4
|
42
51
|
type: :runtime
|
43
52
|
prerelease: false
|
44
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
45
55
|
requirements:
|
46
|
-
- -
|
56
|
+
- - ~>
|
47
57
|
- !ruby/object:Gem::Version
|
48
58
|
version: 0.0.4
|
49
59
|
- !ruby/object:Gem::Dependency
|
50
60
|
name: bundler
|
51
61
|
requirement: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
52
63
|
requirements:
|
53
|
-
- -
|
64
|
+
- - ~>
|
54
65
|
- !ruby/object:Gem::Version
|
55
66
|
version: '1.8'
|
56
67
|
type: :development
|
57
68
|
prerelease: false
|
58
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
59
71
|
requirements:
|
60
|
-
- -
|
72
|
+
- - ~>
|
61
73
|
- !ruby/object:Gem::Version
|
62
74
|
version: '1.8'
|
63
75
|
- !ruby/object:Gem::Dependency
|
64
76
|
name: rake
|
65
77
|
requirement: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
66
79
|
requirements:
|
67
|
-
- -
|
80
|
+
- - ~>
|
68
81
|
- !ruby/object:Gem::Version
|
69
82
|
version: '10.0'
|
70
83
|
type: :development
|
71
84
|
prerelease: false
|
72
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
73
87
|
requirements:
|
74
|
-
- -
|
88
|
+
- - ~>
|
75
89
|
- !ruby/object:Gem::Version
|
76
90
|
version: '10.0'
|
77
91
|
- !ruby/object:Gem::Dependency
|
78
92
|
name: yard
|
79
93
|
requirement: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
80
95
|
requirements:
|
81
|
-
- -
|
96
|
+
- - ~>
|
82
97
|
- !ruby/object:Gem::Version
|
83
98
|
version: '0.8'
|
84
99
|
type: :development
|
85
100
|
prerelease: false
|
86
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
87
103
|
requirements:
|
88
|
-
- -
|
104
|
+
- - ~>
|
89
105
|
- !ruby/object:Gem::Version
|
90
106
|
version: '0.8'
|
91
107
|
- !ruby/object:Gem::Dependency
|
92
108
|
name: simplecov
|
93
109
|
requirement: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
94
111
|
requirements:
|
95
|
-
- -
|
112
|
+
- - ~>
|
96
113
|
- !ruby/object:Gem::Version
|
97
114
|
version: 0.9.1
|
98
115
|
type: :development
|
99
116
|
prerelease: false
|
100
117
|
version_requirements: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
101
119
|
requirements:
|
102
|
-
- -
|
120
|
+
- - ~>
|
103
121
|
- !ruby/object:Gem::Version
|
104
122
|
version: 0.9.1
|
105
123
|
- !ruby/object:Gem::Dependency
|
106
124
|
name: rubocop
|
107
125
|
requirement: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
108
127
|
requirements:
|
109
|
-
- -
|
128
|
+
- - ~>
|
110
129
|
- !ruby/object:Gem::Version
|
111
130
|
version: '0.29'
|
112
131
|
type: :development
|
113
132
|
prerelease: false
|
114
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
115
135
|
requirements:
|
116
|
-
- -
|
136
|
+
- - ~>
|
117
137
|
- !ruby/object:Gem::Version
|
118
138
|
version: '0.29'
|
119
139
|
description: Expectation library with RFC 2119's requirement levels, and some matchers
|
@@ -124,9 +144,9 @@ executables: []
|
|
124
144
|
extensions: []
|
125
145
|
extra_rdoc_files: []
|
126
146
|
files:
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
147
|
+
- .gitignore
|
148
|
+
- .travis.yml
|
149
|
+
- .yardopts
|
130
150
|
- CODE_OF_CONDUCT.md
|
131
151
|
- Gemfile
|
132
152
|
- LICENSE.md
|
@@ -137,6 +157,7 @@ files:
|
|
137
157
|
- bin/setup
|
138
158
|
- lib/spectus.rb
|
139
159
|
- lib/spectus/expectation_target.rb
|
160
|
+
- lib/spectus/matcher.rb
|
140
161
|
- lib/spectus/requirement.rb
|
141
162
|
- lib/spectus/requirement_level/high.rb
|
142
163
|
- lib/spectus/requirement_level/low.rb
|
@@ -147,26 +168,33 @@ files:
|
|
147
168
|
homepage: https://github.com/fixrb/spectus
|
148
169
|
licenses:
|
149
170
|
- MIT
|
150
|
-
metadata: {}
|
151
171
|
post_install_message:
|
152
172
|
rdoc_options: []
|
153
173
|
require_paths:
|
154
174
|
- lib
|
155
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
156
177
|
requirements:
|
157
|
-
- -
|
178
|
+
- - ! '>='
|
158
179
|
- !ruby/object:Gem::Version
|
159
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: 273438499911024764
|
160
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
161
186
|
requirements:
|
162
|
-
- -
|
187
|
+
- - ! '>='
|
163
188
|
- !ruby/object:Gem::Version
|
164
189
|
version: '0'
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
hash: 273438499911024764
|
165
193
|
requirements: []
|
166
194
|
rubyforge_project:
|
167
|
-
rubygems_version:
|
195
|
+
rubygems_version: 1.8.23.2
|
168
196
|
signing_key:
|
169
|
-
specification_version:
|
197
|
+
specification_version: 3
|
170
198
|
summary: Expectation library with requirement levels.
|
171
199
|
test_files: []
|
172
200
|
has_rdoc:
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
AEh.;��҆�Κ��:Y�h�����|��iy;<W�H���bU��J�T�[iҦ��e��<��k>/J*lvG�t�����K�e�o�ܦxUa
|
2
|
+
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 0c3e542950b2210e49686b15023c8be3d160aa49
|
4
|
-
data.tar.gz: b45fe15296e94a7ae911b126172183a9149758f5
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 8ac7132ac401af9effa9b7e2613492a5fa3f4892cfdd302d22d01c500b1c3c63c30ba7e2ee1e429c8acbfaa7d2f0572c3a62926d72f33e5b50d10c51b720a407
|
7
|
-
data.tar.gz: 265522140ef91356450d32a5cf4fa16b0ffaedf9da7209ba7e66c1435e3248df0cf8ae7b56aa6676a42e653e47c2a39cc9308281a0bdd124f6f0c63f49a5b7f4
|
checksums.yaml.gz.sig
DELETED
Binary file
|