spectre-core 2.1.0 → 2.1.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/exe/spectre +1 -1
- data/lib/spectre/assertion.rb +6 -6
- data/lib/spectre/expectation.rb +7 -7
- data/lib/spectre/helpers.rb +1 -1
- data/lib/spectre/version.rb +1 -1
- data/lib/spectre.rb +21 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 903623ea7a511af71aebe1919c91b0b298fed6819310d60a38dc8ad3fd74127d
|
4
|
+
data.tar.gz: 52e66bd3838d220bd3ab57fc91f81d3eff5c7c9c85c5651611a75e99ed133c44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ac252558b5acbc8ad88995759632f69adf7a5b8dd38e373b1f8cf176a047e89019fd568ebd02d0b6a556e6d210499f25ea3f3d7ff74ccaa00f9796d0619c09
|
7
|
+
data.tar.gz: e12befe6472a287a0d94755853e123da29066aab9aeaa8e60e5366019776638730e274f9a0e9f4d3fd87023faaa9961b51fbf9ffc5cfb66edc524f68ec54d7ce
|
data/exe/spectre
CHANGED
@@ -121,7 +121,7 @@ options = OptionParser.new do |opts|
|
|
121
121
|
'Override config option. Use `spectre show` to get list of available options') do |option|
|
122
122
|
index = option.index('=')
|
123
123
|
key = option[0...index]
|
124
|
-
val = option[index + 1..]
|
124
|
+
val = option[(index + 1)..]
|
125
125
|
|
126
126
|
val = val.split(',') if Spectre::CONFIG[key].is_a? Array
|
127
127
|
val = ['true', '1'].include? val if [true, false].include?(Spectre::CONFIG[key])
|
data/lib/spectre/assertion.rb
CHANGED
@@ -11,7 +11,7 @@ module Spectre
|
|
11
11
|
@val = val
|
12
12
|
end
|
13
13
|
|
14
|
-
def evaluate predicate, actual, negate
|
14
|
+
def evaluate? predicate, actual, negate
|
15
15
|
!(!negate ^ predicate.call(@val, actual))
|
16
16
|
end
|
17
17
|
|
@@ -31,8 +31,8 @@ module Spectre
|
|
31
31
|
@second = ValueWrapper.wrap(second)
|
32
32
|
end
|
33
33
|
|
34
|
-
def evaluate predicate, actual, negate
|
35
|
-
@first.evaluate(predicate, actual, negate) or @second.evaluate(predicate, actual, negate)
|
34
|
+
def evaluate? predicate, actual, negate
|
35
|
+
@first.evaluate?(predicate, actual, negate) or @second.evaluate?(predicate, actual, negate)
|
36
36
|
end
|
37
37
|
|
38
38
|
# :nodoc:
|
@@ -48,8 +48,8 @@ module Spectre
|
|
48
48
|
@second = ValueWrapper.wrap(second)
|
49
49
|
end
|
50
50
|
|
51
|
-
def evaluate predicate, actual, negate
|
52
|
-
@first.evaluate(predicate, actual, negate) and @second.evaluate(predicate, actual, negate)
|
51
|
+
def evaluate? predicate, actual, negate
|
52
|
+
@first.evaluate?(predicate, actual, negate) and @second.evaluate?(predicate, actual, negate)
|
53
53
|
end
|
54
54
|
|
55
55
|
# :nodoc:
|
@@ -98,7 +98,7 @@ module Spectre
|
|
98
98
|
@repr += " to #{method}"
|
99
99
|
@repr += expected.nil? ? ' empty' : " #{@expected}"
|
100
100
|
|
101
|
-
success = @expected.evaluate(@predicate, @actual, @negate)
|
101
|
+
success = @expected.evaluate?(@predicate, @actual, @negate)
|
102
102
|
|
103
103
|
return if success
|
104
104
|
|
data/lib/spectre/expectation.rb
CHANGED
@@ -10,7 +10,7 @@ module Spectre
|
|
10
10
|
def should_be value
|
11
11
|
predicate = proc { |expected, actual| expected.to_s == actual.to_s }
|
12
12
|
value = Spectre::Assertion::ValueWrapper.wrap(value)
|
13
|
-
success = value.evaluate(predicate, self, false)
|
13
|
+
success = value.evaluate?(predicate, self, false)
|
14
14
|
|
15
15
|
return if success
|
16
16
|
|
@@ -20,7 +20,7 @@ module Spectre
|
|
20
20
|
def should_be_empty
|
21
21
|
predicate = proc { |_, actual| actual.nil? or (actual.respond_to?(:empty?) and actual.empty?) }
|
22
22
|
value = Spectre::Assertion::ValueWrapper.wrap(nil)
|
23
|
-
success = value.evaluate(predicate, self, false)
|
23
|
+
success = value.evaluate?(predicate, self, false)
|
24
24
|
|
25
25
|
return if success
|
26
26
|
|
@@ -30,7 +30,7 @@ module Spectre
|
|
30
30
|
def should_not_be(value)
|
31
31
|
predicate = proc { |expected, actual| expected.to_s == actual.to_s }
|
32
32
|
value = Spectre::Assertion::ValueWrapper.wrap(value)
|
33
|
-
success = value.evaluate(predicate, self, true)
|
33
|
+
success = value.evaluate?(predicate, self, true)
|
34
34
|
|
35
35
|
return if success
|
36
36
|
|
@@ -40,7 +40,7 @@ module Spectre
|
|
40
40
|
def should_not_exist
|
41
41
|
predicate = proc { |expected, _| expected.respond_to? :nil? and expected.nil? }
|
42
42
|
value = Spectre::Assertion::ValueWrapper.wrap(value)
|
43
|
-
success = value.evaluate(predicate, self, true)
|
43
|
+
success = value.evaluate?(predicate, self, true)
|
44
44
|
|
45
45
|
return if success
|
46
46
|
|
@@ -50,7 +50,7 @@ module Spectre
|
|
50
50
|
def should_not_be_empty
|
51
51
|
predicate = proc { |_, actual| actual.nil? or (actual.respond_to?(:empty?) and actual.empty?) }
|
52
52
|
value = Spectre::Assertion::ValueWrapper.wrap(nil)
|
53
|
-
success = value.evaluate(predicate, self, true)
|
53
|
+
success = value.evaluate?(predicate, self, true)
|
54
54
|
|
55
55
|
return if success
|
56
56
|
|
@@ -64,7 +64,7 @@ module Spectre
|
|
64
64
|
end
|
65
65
|
|
66
66
|
value = Spectre::Assertion::ValueWrapper.wrap(value)
|
67
|
-
success = value.evaluate(predicate, self, false)
|
67
|
+
success = value.evaluate?(predicate, self, false)
|
68
68
|
|
69
69
|
return if success
|
70
70
|
|
@@ -78,7 +78,7 @@ module Spectre
|
|
78
78
|
end
|
79
79
|
|
80
80
|
value = Spectre::Assertion::ValueWrapper.wrap(value)
|
81
|
-
success = value.evaluate(predicate, self, true)
|
81
|
+
success = value.evaluate?(predicate, self, true)
|
82
82
|
|
83
83
|
return if success
|
84
84
|
|
data/lib/spectre/helpers.rb
CHANGED
data/lib/spectre/version.rb
CHANGED
data/lib/spectre.rb
CHANGED
@@ -496,19 +496,19 @@ module Spectre
|
|
496
496
|
.select { |x| x.failures.any? }
|
497
497
|
|
498
498
|
failed.each_with_index do |eval, eval_idx|
|
499
|
-
output += if failed.
|
499
|
+
output += if failed.one?
|
500
500
|
" #{eval.desc}, but"
|
501
501
|
else
|
502
502
|
" #{index}.#{eval_idx + 1}) #{eval.desc}, but"
|
503
503
|
end
|
504
504
|
|
505
|
-
if eval.failures.
|
505
|
+
if eval.failures.one?
|
506
506
|
output += " #{eval.failures.first.message}\n"
|
507
507
|
else
|
508
508
|
output += " #{eval.failures.count} failures occured\n"
|
509
509
|
|
510
510
|
eval.failures.each_with_index do |fail, fail_idx|
|
511
|
-
output += if failed.
|
511
|
+
output += if failed.one?
|
512
512
|
" #{index}.#{fail_idx + 1}) #{fail.message}\n"
|
513
513
|
else
|
514
514
|
" #{index}.#{eval_idx + 1}.#{fail_idx + 1}) #{fail.message}\n"
|
@@ -981,20 +981,22 @@ module Spectre
|
|
981
981
|
define_method(method) do |evaluation, &block|
|
982
982
|
desc = "#{method} #{evaluation}"
|
983
983
|
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
984
|
+
evaluation = if block
|
985
|
+
EvaluationContext.new(@engine, desc, &block)
|
986
|
+
else
|
987
|
+
EvaluationContext.new(@engine, desc) do
|
988
|
+
unless evaluation.failure.nil?
|
989
|
+
@failures << Failure.new(
|
990
|
+
evaluation.failure,
|
991
|
+
evaluation.call_location
|
992
|
+
)
|
993
|
+
end
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
@evaluations << evaluation
|
996
998
|
|
997
|
-
raise AbortException if method == :assert and
|
999
|
+
raise AbortException if method == :assert and evaluation.failures.any?
|
998
1000
|
end
|
999
1001
|
end
|
1000
1002
|
|
@@ -1690,8 +1692,9 @@ module Spectre
|
|
1690
1692
|
|
1691
1693
|
patterns.each do |pattern|
|
1692
1694
|
Dir.glob(pattern).each do |file|
|
1693
|
-
|
1694
|
-
|
1695
|
+
abs_path = File.absolute_path(file)
|
1696
|
+
content = File.read abs_path
|
1697
|
+
instance_eval(content, abs_path, 1)
|
1695
1698
|
end
|
1696
1699
|
end
|
1697
1700
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectre-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Neubauer
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: debug
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.6.
|
116
|
+
rubygems_version: 3.6.9
|
117
117
|
specification_version: 4
|
118
118
|
summary: Describe and run automated tests
|
119
119
|
test_files: []
|