rspec-expectations 3.5.0 → 3.6.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 564420270880a852a9f86af59b32445beff85990
4
- data.tar.gz: 68e50116cd97b1137f8ed688de17db436464b7b5
3
+ metadata.gz: 8232b582b397e192208eb5c3e081b83076aa59d9
4
+ data.tar.gz: 4caa2e9acf45b659b2bf3ecce7e1a1a92d14090a
5
5
  SHA512:
6
- metadata.gz: 18a464c2ffba3b59d6c998419b36462177b5246fd9a66cb73c693358b9985bdffeb6fd4cafc97beff928ced458cb4e70fd78731b2e35a2e7f0aca89d4b1a0e0e
7
- data.tar.gz: b56c7c4cad9670fdf2925a700de34f1be6f14d2d197a12efba71f4f816e0a9a3f4f7c172c019b46ccab5344fe464362642ca53cbe522143fde63ad99d038978b
6
+ metadata.gz: a7575c7bb5042e69e5bd46bc17a0e52740fbe6b05942c9d4f1d164ea78624725bda93cc15b3dd84cae7bd128e6099c628f80e8fd74d49108b98a19c9c3241bd1
7
+ data.tar.gz: 64c465f4842fb35b020c6dd71c1469c0614467cfcbd488d6e476121d7d2ef108dfca836c9266db6206c37570345b1c7d9e20e47aa8f81dc68ab5c4124e98cfef
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,7 +1,17 @@
1
+ ### 3.6.0.beta1 / 2016-10-09
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0...v3.6.0.beta1)
3
+
4
+ Bug Fixes:
5
+
6
+ * Fix `contain_exactly` to work correctly with ranges. (Myron Marston, #940)
7
+ * Fix `change` to work correctly with sets. (Marcin Gajewski, #939)
8
+
1
9
  ### 3.5.0 / 2016-07-01
2
10
  [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta4...v3.5.0)
3
11
 
4
- **No user facing changes since beta4**
12
+ Enhancements:
13
+
14
+ * Add support for keyword arguments to the `respond_to` matcher. (Rob Smith, #915).
5
15
 
6
16
  ### 3.5.0.beta4 / 2016-06-05
7
17
  [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta3...v3.5.0.beta4)
@@ -48,7 +48,7 @@ module RSpec
48
48
 
49
49
  # Defines instance {ExpectationTarget} instance methods. These are defined
50
50
  # in a module so we can include it in `Minitest::Expectation` when
51
- # `rspec/expectations/minitest_integration` is laoded in order to
51
+ # `rspec/expectations/minitest_integration` is loaded in order to
52
52
  # support usage with Minitest.
53
53
  module InstanceMethods
54
54
  # Runs the given expectation, passing if `matcher` returns true.
@@ -1,10 +1,18 @@
1
1
  module RSpec
2
2
  module Expectations
3
3
  class << self
4
+ # @private
5
+ class Differ
6
+ # @private
7
+ OBJECT_PREPARER = lambda do |object|
8
+ RSpec::Matchers::Composable.surface_descriptions_in(object)
9
+ end
10
+ end
11
+
4
12
  # @private
5
13
  def differ
6
14
  RSpec::Support::Differ.new(
7
- :object_preparer => lambda { |object| RSpec::Matchers::Composable.surface_descriptions_in(object) },
15
+ :object_preparer => Differ::OBJECT_PREPARER,
8
16
  :color => RSpec::Matchers.configuration.color?
9
17
  )
10
18
  end
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '3.5.0'
5
+ STRING = '3.6.0.beta1'
6
6
  end
7
7
  end
8
8
  end
@@ -1,6 +1,7 @@
1
1
  module RSpec
2
2
  module Matchers
3
3
  module BuiltIn
4
+ # rubocop:disable ClassLength
4
5
  # @api private
5
6
  # Provides the implementation for `contain_exactly` and `match_array`.
6
7
  # Not intended to be instantiated directly.
@@ -85,7 +86,7 @@ module RSpec
85
86
  def convert_actual_to_an_array
86
87
  if actual.respond_to?(:to_ary)
87
88
  @actual = actual.to_ary
88
- elsif should_enumerate?(actual) && actual.respond_to?(:to_a)
89
+ elsif actual.respond_to?(:to_a) && !to_a_disallowed?(actual)
89
90
  @actual = actual.to_a
90
91
  else
91
92
  return false
@@ -98,6 +99,19 @@ module RSpec
98
99
  array
99
100
  end
100
101
 
102
+ if RUBY_VERSION == "1.8.7"
103
+ def to_a_disallowed?(object)
104
+ case object
105
+ when NilClass, String then true
106
+ else Kernel == RSpec::Support.method_handle_for(object, :to_a).owner
107
+ end
108
+ end
109
+ else
110
+ def to_a_disallowed?(object)
111
+ NilClass === object
112
+ end
113
+ end
114
+
101
115
  def missing_items
102
116
  @missing_items ||= best_solution.unmatched_expected_indexes.map do |index|
103
117
  expected[index]
@@ -281,6 +295,7 @@ module RSpec
281
295
  end
282
296
  end
283
297
  end
298
+ # rubocop:enable ClassLength
284
299
  end
285
300
  end
286
301
  end
@@ -130,8 +130,6 @@ module RSpec
130
130
  object.clone
131
131
  elsif Hash === object
132
132
  Hash[with_matchers_cloned(object.to_a)]
133
- elsif Struct === object || unreadable_io?(object)
134
- object
135
133
  elsif should_enumerate?(object)
136
134
  object.map { |subobject| with_matchers_cloned(subobject) }
137
135
  else
@@ -139,24 +137,10 @@ module RSpec
139
137
  end
140
138
  end
141
139
 
142
- if String.ancestors.include?(Enumerable) # 1.8.7
143
- # :nocov:
144
- # Strings are not enumerable on 1.9, and on 1.8 they are an infinitely
145
- # nested enumerable: since ruby lacks a character class, it yields
146
- # 1-character strings, which are themselves enumerable, composed of a
147
- # a single 1-character string, which is an enumerable, etc.
148
- #
149
- # @api private
150
- def should_enumerate?(item)
151
- return false if String === item
152
- Enumerable === item && !(Range === item) && item.none? { |subitem| subitem.equal?(item) }
153
- end
154
- # :nocov:
155
- else
156
- # @api private
157
- def should_enumerate?(item)
158
- Enumerable === item && !(Range === item) && item.none? { |subitem| subitem.equal?(item) }
159
- end
140
+ # @api private
141
+ # We should enumerate arrays as long as they are not recursive.
142
+ def should_enumerate?(item)
143
+ Array === item && item.none? { |subitem| subitem.equal?(item) }
160
144
  end
161
145
 
162
146
  # @api private
@@ -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
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.6.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -45,22 +45,22 @@ 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: 2016-10-10 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
54
+ - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 3.5.0
56
+ version: 3.6.0.beta1
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.6.0.beta1
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: diff-lcs
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  version: 1.8.7
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
- - - ">="
215
+ - - ">"
216
216
  - !ruby/object:Gem::Version
217
- version: '0'
217
+ version: 1.3.1
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.5.1
220
+ rubygems_version: 2.2.2
221
221
  signing_key:
222
222
  specification_version: 4
223
- summary: rspec-expectations-3.5.0
223
+ summary: rspec-expectations-3.6.0.beta1
224
224
  test_files: []
225
225
  has_rdoc:
metadata.gz.sig CHANGED
Binary file