rspec-expectations 3.5.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +138 -2
- data/README.md +37 -20
- data/lib/rspec/expectations.rb +2 -1
- data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
- data/lib/rspec/expectations/configuration.rb +14 -0
- data/lib/rspec/expectations/expectation_target.rb +2 -2
- data/lib/rspec/expectations/fail_with.rb +9 -1
- data/lib/rspec/expectations/handler.rb +2 -2
- data/lib/rspec/expectations/minitest_integration.rb +1 -1
- data/lib/rspec/expectations/syntax.rb +2 -2
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers.rb +97 -97
- data/lib/rspec/matchers/built_in/all.rb +1 -0
- data/lib/rspec/matchers/built_in/base_matcher.rb +14 -2
- data/lib/rspec/matchers/built_in/be.rb +2 -2
- data/lib/rspec/matchers/built_in/be_instance_of.rb +5 -1
- data/lib/rspec/matchers/built_in/be_kind_of.rb +5 -1
- data/lib/rspec/matchers/built_in/change.rb +127 -53
- data/lib/rspec/matchers/built_in/compound.rb +6 -2
- data/lib/rspec/matchers/built_in/contain_exactly.rb +18 -2
- data/lib/rspec/matchers/built_in/exist.rb +5 -1
- data/lib/rspec/matchers/built_in/has.rb +1 -1
- data/lib/rspec/matchers/built_in/include.rb +6 -0
- data/lib/rspec/matchers/built_in/raise_error.rb +1 -1
- data/lib/rspec/matchers/built_in/respond_to.rb +13 -4
- data/lib/rspec/matchers/built_in/satisfy.rb +27 -4
- data/lib/rspec/matchers/built_in/yield.rb +43 -30
- data/lib/rspec/matchers/composable.rb +6 -20
- data/lib/rspec/matchers/dsl.rb +72 -4
- data/lib/rspec/matchers/english_phrasing.rb +3 -3
- data/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +16 -7
- data/lib/rspec/matchers/generated_descriptions.rb +1 -2
- metadata +22 -18
- metadata.gz.sig +0 -0
@@ -7,7 +7,7 @@ module RSpec
|
|
7
7
|
# split_words(:banana_creme_pie) #=> "banana creme pie"
|
8
8
|
#
|
9
9
|
def self.split_words(sym)
|
10
|
-
sym.to_s.
|
10
|
+
sym.to_s.tr('_', ' ')
|
11
11
|
end
|
12
12
|
|
13
13
|
# @note The returned string has a leading space except
|
@@ -44,14 +44,14 @@ module RSpec
|
|
44
44
|
# So it appears that `Array` can trigger that (e.g. by calling `to_a` on the passed object?)
|
45
45
|
# So here we replace `Kernel#Array` with our own warning-free implementation for 1.8.7.
|
46
46
|
# @private
|
47
|
-
# rubocop:disable
|
47
|
+
# rubocop:disable Naming/MethodName
|
48
48
|
def self.Array(obj)
|
49
49
|
case obj
|
50
50
|
when Array then obj
|
51
51
|
else [obj]
|
52
52
|
end
|
53
53
|
end
|
54
|
-
# rubocop:enable
|
54
|
+
# rubocop:enable Naming/MethodName
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -52,20 +52,29 @@ module RSpec
|
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
class << self
|
56
|
+
private
|
57
|
+
|
58
|
+
def diff_label_for(matcher)
|
59
|
+
"Diff for (#{truncated(RSpec::Support::ObjectFormatter.format(matcher))}):"
|
60
|
+
end
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
+
def truncated(description)
|
63
|
+
return description if description.length <= DESCRIPTION_MAX_LENGTH
|
64
|
+
description[0...DESCRIPTION_MAX_LENGTH - 3] << "..."
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
def diffs(differ, actual)
|
65
69
|
@expected_list.map do |(expected, diff_label)|
|
66
70
|
diff = differ.diff(actual, expected)
|
67
71
|
next if diff.strip.empty?
|
68
|
-
|
72
|
+
if diff == "\e[0m\n\e[0m"
|
73
|
+
"#{diff_label}\n" \
|
74
|
+
" <The diff is empty, are your objects producing identical `#inspect` output?>"
|
75
|
+
else
|
76
|
+
"#{diff_label}#{diff}"
|
77
|
+
end
|
69
78
|
end.compact.join("\n")
|
70
79
|
end
|
71
80
|
end
|
@@ -21,8 +21,7 @@ module RSpec
|
|
21
21
|
"#{last_expectation_handler.verb} #{last_description}"
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
# @private
|
26
25
|
def self.last_description
|
27
26
|
last_matcher.respond_to?(:description) ? last_matcher.description : <<-MESSAGE
|
28
27
|
When you call a matcher in an example without a String, like this:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -45,7 +45,7 @@ cert_chain:
|
|
45
45
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
46
46
|
F3MdtaDehhjC
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date:
|
48
|
+
date: 2019-10-07 00:00:00.000000000 Z
|
49
49
|
dependencies:
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rspec-support
|
@@ -53,14 +53,14 @@ dependencies:
|
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.
|
56
|
+
version: 3.9.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 3.
|
63
|
+
version: 3.9.0
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: diff-lcs
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,19 +82,19 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '2.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: aruba
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 0.14.10
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 0.14.10
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: cucumber
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,33 +110,33 @@ dependencies:
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '1.3'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
113
|
+
name: minitest
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: '5.2'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: '5.2'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
127
|
+
name: rake
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 10.0.0
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 10.0.0
|
140
140
|
description: rspec-expectations provides a simple, readable API to express expected
|
141
141
|
outcomes of a code example.
|
142
142
|
email: rspec@googlegroups.com
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- LICENSE.md
|
151
151
|
- README.md
|
152
152
|
- lib/rspec/expectations.rb
|
153
|
+
- lib/rspec/expectations/block_snippet_extractor.rb
|
153
154
|
- lib/rspec/expectations/configuration.rb
|
154
155
|
- lib/rspec/expectations/expectation_target.rb
|
155
156
|
- lib/rspec/expectations/fail_with.rb
|
@@ -199,7 +200,12 @@ files:
|
|
199
200
|
homepage: https://github.com/rspec/rspec-expectations
|
200
201
|
licenses:
|
201
202
|
- MIT
|
202
|
-
metadata:
|
203
|
+
metadata:
|
204
|
+
bug_tracker_uri: https://github.com/rspec/rspec-expectations/issues
|
205
|
+
changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.9.0/Changelog.md
|
206
|
+
documentation_uri: https://rspec.info/documentation/
|
207
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
208
|
+
source_code_uri: https://github.com/rspec/rspec-expectations
|
203
209
|
post_install_message:
|
204
210
|
rdoc_options:
|
205
211
|
- "--charset=UTF-8"
|
@@ -216,10 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
222
|
- !ruby/object:Gem::Version
|
217
223
|
version: '0'
|
218
224
|
requirements: []
|
219
|
-
|
220
|
-
rubygems_version: 2.5.1
|
225
|
+
rubygems_version: 3.0.6
|
221
226
|
signing_key:
|
222
227
|
specification_version: 4
|
223
|
-
summary: rspec-expectations-3.
|
228
|
+
summary: rspec-expectations-3.9.0
|
224
229
|
test_files: []
|
225
|
-
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|