spectre-core 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/spectre/assertion.rb +18 -8
- data/lib/spectre.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec3e298c4efb325f628370a3855a110136cba4a9d7f870db90d95a5b39c9e8a
|
4
|
+
data.tar.gz: fde6391319206d2f8d603b02be31f0f5bb72d424fcb25541b9be0597670ce49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fdb065d1ce08d8c4e78e164bc1caad26ed03d50f4cf6199398699859cb9a81a00260b6e3af785de4a7852aa45da1ae61a2977b0b92bbb5c0c832e6079178cce
|
7
|
+
data.tar.gz: ce6b95998d3e3145876bc1d7bb8fe06ce941f1327a6a283557e9944447ffba888c3012124c474d0321f5e9eb91914b53fbdd285255f947db34dd783e084446b5
|
data/lib/spectre/assertion.rb
CHANGED
@@ -10,7 +10,7 @@ module Spectre
|
|
10
10
|
class ::Object
|
11
11
|
def should_be(value)
|
12
12
|
evaluate(value, "#{self} should be #{value}") do |x|
|
13
|
-
self.
|
13
|
+
self.to_s == x.to_s
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -128,7 +128,9 @@ module Spectre
|
|
128
128
|
|
129
129
|
class ::String
|
130
130
|
def should_be(val)
|
131
|
-
|
131
|
+
evaluate(val, "'#{self}' should be '#{val}'") do |x|
|
132
|
+
self.to_s == x.to_s
|
133
|
+
end
|
132
134
|
end
|
133
135
|
|
134
136
|
def should_be_empty
|
@@ -136,29 +138,37 @@ module Spectre
|
|
136
138
|
end
|
137
139
|
|
138
140
|
def should_not_be(val)
|
139
|
-
|
141
|
+
evaluate(value, "'#{self}' should not be '#{value}'") do |x|
|
142
|
+
self.to_s != x.to_s
|
143
|
+
end
|
140
144
|
end
|
141
145
|
|
142
146
|
def should_not_be_empty
|
143
147
|
raise AssertionFailure.new('Text should not be empty', 'nothing', self) unless not self.empty?
|
144
148
|
end
|
145
149
|
|
146
|
-
def should_contain(
|
147
|
-
evaluate(
|
150
|
+
def should_contain(val)
|
151
|
+
evaluate(val, "'#{self.trim}' should contain '#{val.to_s}'") do |x|
|
148
152
|
self.include? x.to_s
|
149
153
|
end
|
150
154
|
end
|
151
155
|
|
152
156
|
def should_not_contain(val)
|
153
|
-
|
157
|
+
evaluate(val, "'#{self}' should not contain '#{val}'") do |x|
|
158
|
+
not self.include? x.to_s
|
159
|
+
end
|
154
160
|
end
|
155
161
|
|
156
162
|
def should_match(regex)
|
157
|
-
|
163
|
+
evaluate(regex, "'#{self.trim}' should match /#{regex}/") do |x|
|
164
|
+
self.match(x)
|
165
|
+
end
|
158
166
|
end
|
159
167
|
|
160
168
|
def should_not_match(regex)
|
161
|
-
|
169
|
+
evaluate(regex, "'#{self.trim}' should not match '#{regex}'") do |x|
|
170
|
+
not self.match(x)
|
171
|
+
end
|
162
172
|
end
|
163
173
|
|
164
174
|
alias :| :or
|
data/lib/spectre.rb
CHANGED