rspec-expectations 3.9.1 → 3.9.2
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
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/Changelog.md +13 -0
 - data/lib/rspec/expectations/version.rb +1 -1
 - data/lib/rspec/matchers/built_in/yield.rb +25 -16
 - data/lib/rspec/matchers/dsl.rb +8 -2
 - metadata +6 -6
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1c3782b5fc827b30a6433002b18fb8c7f4d86a17f8cbaf2c88a6bd89425d94ee
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1d687e53cb7b7b7b93849c1bc094d46c23fb11cf00aa066bf7a5a0aabcf999d3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5c938d05c02512b2b8494ddf429732693235147cfdd1e0c316bb33e7fe61b239db113f88927af94d6458d529ab06f1195fa40c9bf7f24e0e0ad718be6a87db20
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 43d0b0013d79ab9e4a5a9bcd4ebceef0b660fa1356a5ce4f77f1828d1194ee789e66ebf0cc45081045818297f408ff7c871ebcc9930822a639f8308d5f21dfb0
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/Changelog.md
    CHANGED
    
    | 
         @@ -1,3 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ### Development
         
     | 
| 
      
 2 
     | 
    
         
            +
            [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.2...3-9-maintenance)
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ### 3.9.2 / 2020-05-08
         
     | 
| 
      
 5 
     | 
    
         
            +
            [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.1...v3.9.2)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Bug Fixes:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * Issue a proper `ArgumentError` when invalid arguments are given to `yield_control`
         
     | 
| 
      
 10 
     | 
    
         
            +
              modifiers such as `at_least` et al. (Marc-André Lafortune, #1167)
         
     | 
| 
      
 11 
     | 
    
         
            +
            * Prevent Ruby 2.7 keyword arguments warning from being issued by custom
         
     | 
| 
      
 12 
     | 
    
         
            +
              matcher definitions. (Jon Rowe, #1176)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       1 
14 
     | 
    
         
             
            ### 3.9.1 / 2020-03-13
         
     | 
| 
       2 
15 
     | 
    
         
             
            [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.0...v3.9.1)
         
     | 
| 
       3 
16 
     | 
    
         | 
| 
         @@ -98,7 +98,7 @@ module RSpec 
     | 
|
| 
       98 
98 
     | 
    
         
             
                  # Not intended to be instantiated directly.
         
     | 
| 
       99 
99 
     | 
    
         
             
                  class YieldControl < BaseMatcher
         
     | 
| 
       100 
100 
     | 
    
         
             
                    def initialize
         
     | 
| 
       101 
     | 
    
         
            -
                       
     | 
| 
      
 101 
     | 
    
         
            +
                      @expectation_type = @expected_yields_count = nil
         
     | 
| 
       102 
102 
     | 
    
         
             
                    end
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
104 
     | 
    
         
             
                    # @api public
         
     | 
| 
         @@ -153,7 +153,7 @@ module RSpec 
     | 
|
| 
       153 
153 
     | 
    
         
             
                    def matches?(block)
         
     | 
| 
       154 
154 
     | 
    
         
             
                      @probe = YieldProbe.probe(block)
         
     | 
| 
       155 
155 
     | 
    
         
             
                      return false unless @probe.has_block?
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 156 
     | 
    
         
            +
                      return @probe.num_yields > 0 unless @expectation_type
         
     | 
| 
       157 
157 
     | 
    
         
             
                      @probe.num_yields.__send__(@expectation_type, @expected_yields_count)
         
     | 
| 
       158 
158 
     | 
    
         
             
                    end
         
     | 
| 
       159 
159 
     | 
    
         | 
| 
         @@ -182,35 +182,44 @@ module RSpec 
     | 
|
| 
       182 
182 
     | 
    
         
             
                  private
         
     | 
| 
       183 
183 
     | 
    
         | 
| 
       184 
184 
     | 
    
         
             
                    def set_expected_yields_count(relativity, n)
         
     | 
| 
      
 185 
     | 
    
         
            +
                      raise "Multiple count constraints are not supported" if @expectation_type
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
       185 
187 
     | 
    
         
             
                      @expectation_type = relativity
         
     | 
| 
       186 
     | 
    
         
            -
                      @expected_yields_count =  
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
      
 188 
     | 
    
         
            +
                      @expected_yields_count = count_constraint_to_number(n)
         
     | 
| 
      
 189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                    def count_constraint_to_number(n)
         
     | 
| 
      
 192 
     | 
    
         
            +
                      case n
         
     | 
| 
      
 193 
     | 
    
         
            +
                      when Numeric then n
         
     | 
| 
      
 194 
     | 
    
         
            +
                      when :once then 1
         
     | 
| 
      
 195 
     | 
    
         
            +
                      when :twice then 2
         
     | 
| 
      
 196 
     | 
    
         
            +
                      when :thrice then 3
         
     | 
| 
      
 197 
     | 
    
         
            +
                      else
         
     | 
| 
      
 198 
     | 
    
         
            +
                        raise ArgumentError, "Expected a number, :once, :twice or :thrice," \
         
     | 
| 
      
 199 
     | 
    
         
            +
                          " but got #{n}"
         
     | 
| 
      
 200 
     | 
    
         
            +
                      end
         
     | 
| 
       192 
201 
     | 
    
         
             
                    end
         
     | 
| 
       193 
202 
     | 
    
         | 
| 
       194 
203 
     | 
    
         
             
                    def failure_reason
         
     | 
| 
       195 
204 
     | 
    
         
             
                      return ' but was not a block' unless @probe.has_block?
         
     | 
| 
       196 
     | 
    
         
            -
                       
     | 
| 
       197 
     | 
    
         
            -
                      " #{ 
     | 
| 
       198 
     | 
    
         
            -
                      " but yielded #{human_readable_count(@probe.num_yields)}"
         
     | 
| 
      
 205 
     | 
    
         
            +
                      "#{human_readable_expectation_type}#{human_readable_count(@expected_yields_count)}" \
         
     | 
| 
      
 206 
     | 
    
         
            +
                      " but yielded#{human_readable_count(@probe.num_yields)}"
         
     | 
| 
       199 
207 
     | 
    
         
             
                    end
         
     | 
| 
       200 
208 
     | 
    
         | 
| 
       201 
209 
     | 
    
         
             
                    def human_readable_expectation_type
         
     | 
| 
       202 
210 
     | 
    
         
             
                      case @expectation_type
         
     | 
| 
       203 
     | 
    
         
            -
                      when :<= then 'at most 
     | 
| 
       204 
     | 
    
         
            -
                      when :>= then 'at least 
     | 
| 
      
 211 
     | 
    
         
            +
                      when :<= then ' at most'
         
     | 
| 
      
 212 
     | 
    
         
            +
                      when :>= then ' at least'
         
     | 
| 
       205 
213 
     | 
    
         
             
                      else ''
         
     | 
| 
       206 
214 
     | 
    
         
             
                      end
         
     | 
| 
       207 
215 
     | 
    
         
             
                    end
         
     | 
| 
       208 
216 
     | 
    
         | 
| 
       209 
217 
     | 
    
         
             
                    def human_readable_count(count)
         
     | 
| 
       210 
218 
     | 
    
         
             
                      case count
         
     | 
| 
       211 
     | 
    
         
            -
                      when  
     | 
| 
       212 
     | 
    
         
            -
                      when  
     | 
| 
       213 
     | 
    
         
            -
                       
     | 
| 
      
 219 
     | 
    
         
            +
                      when nil then ''
         
     | 
| 
      
 220 
     | 
    
         
            +
                      when 1 then ' once'
         
     | 
| 
      
 221 
     | 
    
         
            +
                      when 2 then ' twice'
         
     | 
| 
      
 222 
     | 
    
         
            +
                      else " #{count} times"
         
     | 
| 
       214 
223 
     | 
    
         
             
                      end
         
     | 
| 
       215 
224 
     | 
    
         
             
                    end
         
     | 
| 
       216 
225 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/rspec/matchers/dsl.rb
    CHANGED
    
    | 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            RSpec::Support.require_rspec_support "with_keywords_when_needed"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module RSpec
         
     | 
| 
       2 
4 
     | 
    
         
             
              module Matchers
         
     | 
| 
       3 
5 
     | 
    
         
             
                # Defines the custom matcher DSL.
         
     | 
| 
         @@ -460,11 +462,12 @@ module RSpec 
     | 
|
| 
       460 
462 
     | 
    
         
             
                      @chained_method_clauses = []
         
     | 
| 
       461 
463 
     | 
    
         
             
                      @block_arg = block_arg
         
     | 
| 
       462 
464 
     | 
    
         | 
| 
       463 
     | 
    
         
            -
                      class << self
         
     | 
| 
      
 465 
     | 
    
         
            +
                      klass = class << self
         
     | 
| 
       464 
466 
     | 
    
         
             
                        # See `Macros#define_user_override` above, for an explanation.
         
     | 
| 
       465 
467 
     | 
    
         
             
                        include(@user_method_defs = Module.new)
         
     | 
| 
       466 
468 
     | 
    
         
             
                        self
         
     | 
| 
       467 
     | 
    
         
            -
                      end 
     | 
| 
      
 469 
     | 
    
         
            +
                      end
         
     | 
| 
      
 470 
     | 
    
         
            +
                      RSpec::Support::WithKeywordsWhenNeeded.class_exec(klass, *expected, &declarations)
         
     | 
| 
       468 
471 
     | 
    
         
             
                    end
         
     | 
| 
       469 
472 
     | 
    
         | 
| 
       470 
473 
     | 
    
         
             
                    # Provides the expected value. This will return an array if
         
     | 
| 
         @@ -528,6 +531,9 @@ module RSpec 
     | 
|
| 
       528 
531 
     | 
    
         
             
                        super(method, *args, &block)
         
     | 
| 
       529 
532 
     | 
    
         
             
                      end
         
     | 
| 
       530 
533 
     | 
    
         
             
                    end
         
     | 
| 
      
 534 
     | 
    
         
            +
                    # The method_missing method should be refactored to pass kw args in RSpec 4
         
     | 
| 
      
 535 
     | 
    
         
            +
                    # then this can be removed
         
     | 
| 
      
 536 
     | 
    
         
            +
                    ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
         
     | 
| 
       531 
537 
     | 
    
         
             
                  end
         
     | 
| 
       532 
538 
     | 
    
         
             
                end
         
     | 
| 
       533 
539 
     | 
    
         
             
              end
         
     | 
    
        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.9. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.9.2
         
     | 
| 
       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: 2020- 
     | 
| 
      
 48 
     | 
    
         
            +
            date: 2020-05-08 00:00:00.000000000 Z
         
     | 
| 
       49 
49 
     | 
    
         
             
            dependencies:
         
     | 
| 
       50 
50 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       51 
51 
     | 
    
         
             
              name: rspec-support
         
     | 
| 
         @@ -127,14 +127,14 @@ dependencies: 
     | 
|
| 
       127 
127 
     | 
    
         
             
              name: rake
         
     | 
| 
       128 
128 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       129 
129 
     | 
    
         
             
                requirements:
         
     | 
| 
       130 
     | 
    
         
            -
                - - " 
     | 
| 
      
 130 
     | 
    
         
            +
                - - ">"
         
     | 
| 
       131 
131 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       132 
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 
139 
     | 
    
         
             
                    version: 10.0.0
         
     | 
| 
       140 
140 
     | 
    
         
             
            description: rspec-expectations provides a simple, readable API to express expected
         
     | 
| 
         @@ -202,7 +202,7 @@ licenses: 
     | 
|
| 
       202 
202 
     | 
    
         
             
            - MIT
         
     | 
| 
       203 
203 
     | 
    
         
             
            metadata:
         
     | 
| 
       204 
204 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rspec/rspec-expectations/issues
         
     | 
| 
       205 
     | 
    
         
            -
              changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.9. 
     | 
| 
      
 205 
     | 
    
         
            +
              changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.9.2/Changelog.md
         
     | 
| 
       206 
206 
     | 
    
         
             
              documentation_uri: https://rspec.info/documentation/
         
     | 
| 
       207 
207 
     | 
    
         
             
              mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
         
     | 
| 
       208 
208 
     | 
    
         
             
              source_code_uri: https://github.com/rspec/rspec-expectations
         
     | 
| 
         @@ -225,5 +225,5 @@ requirements: [] 
     | 
|
| 
       225 
225 
     | 
    
         
             
            rubygems_version: 3.1.2
         
     | 
| 
       226 
226 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       227 
227 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       228 
     | 
    
         
            -
            summary: rspec-expectations-3.9. 
     | 
| 
      
 228 
     | 
    
         
            +
            summary: rspec-expectations-3.9.2
         
     | 
| 
       229 
229 
     | 
    
         
             
            test_files: []
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |