rspec-expectations 3.5.0.beta2 → 3.5.0.beta3

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: 78f6f9a82ac0ab92dc9ad76030846c26f2f614d8
4
- data.tar.gz: ff97acba6c6cc32e8390f68e41d4986da7328323
3
+ metadata.gz: 0a6496869e9518ad7b96e0618ee997db0f593545
4
+ data.tar.gz: b975ea80a7855d3b8e596e94fb5e474efff707aa
5
5
  SHA512:
6
- metadata.gz: 0ed056aabff3b938a44a25e11160435561730eda169a5ef34a2cf0849a08bbf1a4c926e7715529179f2c9c2eb7735972d634d8c2f364fda0b1106945e8d5a442
7
- data.tar.gz: 6e4167883a703dcb4486ad9a9061b2c00535d60c96c04d486eccf37beb13ecde7edcf75f422e357d7359afd2064e2d44d552357604aca33ef7720644ed017ce0
6
+ metadata.gz: 9142626323678bbaba0597848663d5c1fdf85f29920507246ce4d376a93f44adc1511f877c43ce7251270e9573c1d8d0b6324898a155d9e25912fe6b71ad0d90
7
+ data.tar.gz: 610ed1c18c06411a1506884a13b73d6951d39c7d0035d9360d45d915df721c04676db5ad1257c28d4f2a111aa2629062934f83f3867bc3359dc86e76cfff8813
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -9,6 +9,12 @@ Enhancements:
9
9
  `notify_expectation_failures: true` option for the `match` method to
10
10
  allow expectation failures to be raised as normal instead of being
11
11
  converted into a `false` return value for `matches?`. (Jon Rowe, #892)
12
+ * Make `rspec/expectations/minitest_integration` work on Minitest::Spec
13
+ 5.6+. (Myron Marston, #904)
14
+ * Add an alias `having_attributes` for `have_attributes` matcher.
15
+ (Yuji Nakayama, #905)
16
+ * Improve `change` matcher error message when block is mis-used.
17
+ (Alex Altair, #908)
12
18
 
13
19
  Bug Fixes:
14
20
 
@@ -21,6 +21,12 @@ module RSpec
21
21
  # `nil` is a valid value to pass.
22
22
  UndefinedValue = Module.new
23
23
 
24
+ # @note this name aligns with `Minitest::Expectation` so that our
25
+ # {InstanceMethods} module can be included in that class when
26
+ # used in a Minitest context.
27
+ # @return [Object] the target of the expectation
28
+ attr_reader :target
29
+
24
30
  # @api private
25
31
  def initialize(value)
26
32
  @target = value
@@ -40,40 +46,48 @@ module RSpec
40
46
  end
41
47
  end
42
48
 
43
- # Runs the given expectation, passing if `matcher` returns true.
44
- # @example
45
- # expect(value).to eq(5)
46
- # expect { perform }.to raise_error
47
- # @param [Matcher]
48
- # matcher
49
- # @param [String or Proc] message optional message to display when the expectation fails
50
- # @return [Boolean] true if the expectation succeeds (else raises)
51
- # @see RSpec::Matchers
52
- def to(matcher=nil, message=nil, &block)
53
- prevent_operator_matchers(:to) unless matcher
54
- RSpec::Expectations::PositiveExpectationHandler.handle_matcher(@target, matcher, message, &block)
55
- end
49
+ # Defines instance {ExpectationTarget} instance methods. These are defined
50
+ # in a module so we can include it in `Minitest::Expectation` when
51
+ # `rspec/expectations/minitest_integration` is laoded in order to
52
+ # support usage with Minitest.
53
+ module InstanceMethods
54
+ # Runs the given expectation, passing if `matcher` returns true.
55
+ # @example
56
+ # expect(value).to eq(5)
57
+ # expect { perform }.to raise_error
58
+ # @param [Matcher]
59
+ # matcher
60
+ # @param [String or Proc] message optional message to display when the expectation fails
61
+ # @return [Boolean] true if the expectation succeeds (else raises)
62
+ # @see RSpec::Matchers
63
+ def to(matcher=nil, message=nil, &block)
64
+ prevent_operator_matchers(:to) unless matcher
65
+ RSpec::Expectations::PositiveExpectationHandler.handle_matcher(target, matcher, message, &block)
66
+ end
56
67
 
57
- # Runs the given expectation, passing if `matcher` returns false.
58
- # @example
59
- # expect(value).not_to eq(5)
60
- # @param [Matcher]
61
- # matcher
62
- # @param [String or Proc] message optional message to display when the expectation fails
63
- # @return [Boolean] false if the negative expectation succeeds (else raises)
64
- # @see RSpec::Matchers
65
- def not_to(matcher=nil, message=nil, &block)
66
- prevent_operator_matchers(:not_to) unless matcher
67
- RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)
68
- end
69
- alias to_not not_to
68
+ # Runs the given expectation, passing if `matcher` returns false.
69
+ # @example
70
+ # expect(value).not_to eq(5)
71
+ # @param [Matcher]
72
+ # matcher
73
+ # @param [String or Proc] message optional message to display when the expectation fails
74
+ # @return [Boolean] false if the negative expectation succeeds (else raises)
75
+ # @see RSpec::Matchers
76
+ def not_to(matcher=nil, message=nil, &block)
77
+ prevent_operator_matchers(:not_to) unless matcher
78
+ RSpec::Expectations::NegativeExpectationHandler.handle_matcher(target, matcher, message, &block)
79
+ end
80
+ alias to_not not_to
70
81
 
71
- private
82
+ private
72
83
 
73
- def prevent_operator_matchers(verb)
74
- raise ArgumentError, "The expect syntax does not support operator matchers, " \
75
- "so you must pass a matcher to `##{verb}`."
84
+ def prevent_operator_matchers(verb)
85
+ raise ArgumentError, "The expect syntax does not support operator matchers, " \
86
+ "so you must pass a matcher to `##{verb}`."
87
+ end
76
88
  end
89
+
90
+ include InstanceMethods
77
91
  end
78
92
 
79
93
  # @private
@@ -3,8 +3,12 @@ require 'rspec/expectations'
3
3
  Minitest::Test.class_eval do
4
4
  include ::RSpec::Matchers
5
5
 
6
+ # This `expect` will only be called if the user is using Minitest < 5.6
7
+ # or if they are _not_ using Minitest::Spec on 5.6+. Minitest::Spec on 5.6+
8
+ # defines its own `expect` and will have the assertions incremented via our
9
+ # definitions of `to`/`not_to`/`to_not` below.
6
10
  def expect(*a, &b)
7
- assert(true) # so each expectation gets counted in minitest's assertion stats
11
+ self.assertions += 1
8
12
  super
9
13
  end
10
14
 
@@ -22,6 +26,29 @@ Minitest::Test.class_eval do
22
26
  end
23
27
  end
24
28
 
29
+ # Older versions of Minitest (e.g. before 5.6) do not define
30
+ # `Minitest::Expectation`.
31
+ if defined?(::Minitest::Expectation)
32
+ Minitest::Expectation.class_eval do
33
+ include RSpec::Expectations::ExpectationTarget::InstanceMethods
34
+
35
+ def to(*args)
36
+ ctx.assertions += 1
37
+ super
38
+ end
39
+
40
+ def not_to(*args)
41
+ ctx.assertions += 1
42
+ super
43
+ end
44
+
45
+ def to_not(*args)
46
+ ctx.assertions += 1
47
+ super
48
+ end
49
+ end
50
+ end
51
+
25
52
  module RSpec
26
53
  module Expectations
27
54
  remove_const :ExpectationNotMetError
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '3.5.0.beta2'
5
+ STRING = '3.5.0.beta3'
6
6
  end
7
7
  end
8
8
  end
@@ -621,6 +621,7 @@ module RSpec
621
621
  BuiltIn::HaveAttributes.new(expected)
622
622
  end
623
623
  alias_matcher :an_object_having_attributes, :have_attributes
624
+ alias_matcher :having_attributes, :have_attributes
624
625
 
625
626
  # Passes if actual includes expected. This works for
626
627
  # collections and Strings. You can also pass in multiple args
@@ -87,8 +87,8 @@ module RSpec
87
87
  end
88
88
 
89
89
  def raise_block_syntax_error
90
- raise SyntaxError, "The block passed to the `change` matcher must " \
91
- "use `{ ... }` instead of do/end"
90
+ raise SyntaxError, "Block not received by the `change` matcher. " \
91
+ "Perhaps you want to use `{ ... }` instead of do/end?"
92
92
  end
93
93
 
94
94
  def positive_failure_reason
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.beta2
4
+ version: 3.5.0.beta3
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-03-10 00:00:00.000000000 Z
48
+ date: 2016-04-02 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.beta2
56
+ version: 3.5.0.beta3
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.beta2
63
+ version: 3.5.0.beta3
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: diff-lcs
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -196,7 +196,7 @@ files:
196
196
  - lib/rspec/matchers/generated_descriptions.rb
197
197
  - lib/rspec/matchers/matcher_delegator.rb
198
198
  - lib/rspec/matchers/matcher_protocol.rb
199
- homepage: http://github.com/rspec/rspec-expectations
199
+ homepage: https://github.com/rspec/rspec-expectations
200
200
  licenses:
201
201
  - MIT
202
202
  metadata: {}
@@ -217,9 +217,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: 1.3.1
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.5.1
220
+ rubygems_version: 2.4.5.1
221
221
  signing_key:
222
222
  specification_version: 4
223
- summary: rspec-expectations-3.5.0.beta2
223
+ summary: rspec-expectations-3.5.0.beta3
224
224
  test_files: []
225
225
  has_rdoc:
metadata.gz.sig CHANGED
Binary file