rspec-expectations 3.5.0 → 3.9.0

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.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +138 -2
  5. data/README.md +37 -20
  6. data/lib/rspec/expectations.rb +2 -1
  7. data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  8. data/lib/rspec/expectations/configuration.rb +14 -0
  9. data/lib/rspec/expectations/expectation_target.rb +2 -2
  10. data/lib/rspec/expectations/fail_with.rb +9 -1
  11. data/lib/rspec/expectations/handler.rb +2 -2
  12. data/lib/rspec/expectations/minitest_integration.rb +1 -1
  13. data/lib/rspec/expectations/syntax.rb +2 -2
  14. data/lib/rspec/expectations/version.rb +1 -1
  15. data/lib/rspec/matchers.rb +97 -97
  16. data/lib/rspec/matchers/built_in/all.rb +1 -0
  17. data/lib/rspec/matchers/built_in/base_matcher.rb +14 -2
  18. data/lib/rspec/matchers/built_in/be.rb +2 -2
  19. data/lib/rspec/matchers/built_in/be_instance_of.rb +5 -1
  20. data/lib/rspec/matchers/built_in/be_kind_of.rb +5 -1
  21. data/lib/rspec/matchers/built_in/change.rb +127 -53
  22. data/lib/rspec/matchers/built_in/compound.rb +6 -2
  23. data/lib/rspec/matchers/built_in/contain_exactly.rb +18 -2
  24. data/lib/rspec/matchers/built_in/exist.rb +5 -1
  25. data/lib/rspec/matchers/built_in/has.rb +1 -1
  26. data/lib/rspec/matchers/built_in/include.rb +6 -0
  27. data/lib/rspec/matchers/built_in/raise_error.rb +1 -1
  28. data/lib/rspec/matchers/built_in/respond_to.rb +13 -4
  29. data/lib/rspec/matchers/built_in/satisfy.rb +27 -4
  30. data/lib/rspec/matchers/built_in/yield.rb +43 -30
  31. data/lib/rspec/matchers/composable.rb +6 -20
  32. data/lib/rspec/matchers/dsl.rb +72 -4
  33. data/lib/rspec/matchers/english_phrasing.rb +3 -3
  34. data/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +16 -7
  35. data/lib/rspec/matchers/generated_descriptions.rb +1 -2
  36. metadata +22 -18
  37. 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.gsub(/_/, ' ')
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 Style/MethodName
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 Style/MethodName
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
- def self.diff_label_for(matcher)
56
- "Diff for (#{truncated(RSpec::Support::ObjectFormatter.format(matcher))}):"
57
- end
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
- def self.truncated(description)
60
- return description if description.length <= DESCRIPTION_MAX_LENGTH
61
- description[0...DESCRIPTION_MAX_LENGTH - 3] << "..."
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
- "#{diff_label}#{diff}"
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
- private
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.5.0
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: 2016-07-01 00:00:00.000000000 Z
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.5.0
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.5.0
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: rake
85
+ name: aruba
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 10.0.0
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: 10.0.0
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: aruba
113
+ name: minitest
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 0.6.2
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: 0.6.2
125
+ version: '5.2'
126
126
  - !ruby/object:Gem::Dependency
127
- name: minitest
127
+ name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '5.2'
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: '5.2'
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
- rubyforge_project:
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.5.0
228
+ summary: rspec-expectations-3.9.0
224
229
  test_files: []
225
- has_rdoc:
metadata.gz.sig CHANGED
Binary file