test-helpers 0.1.0 → 0.1.1
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 +13 -5
- data/lib/test-helpers/all.rb +2 -0
- data/lib/{test-helpers.rb → test-helpers/test-helpers.rb} +1 -3
- data/lib/test-helpers/wait/wait.rb +41 -0
- data/lib/test-helpers/wait.rb +2 -0
- metadata +13 -10
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
             | 
| 2 | 
            +
            !binary "U0hBMQ==":
         | 
| 3 | 
            +
              metadata.gz: !binary |-
         | 
| 4 | 
            +
                OWJkODFjZThjNmIzZWQyOWJkODI0MTY0MWQ5MjU3NjUwYWFiMGE5YQ==
         | 
| 5 | 
            +
              data.tar.gz: !binary |-
         | 
| 6 | 
            +
                MDE2NGFjYjU3YzFhNzE4N2EyMzg0MDBiZDczMmRkYzBhZWM5MTg3NA==
         | 
| 5 7 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
             | 
| 8 | 
            +
              metadata.gz: !binary |-
         | 
| 9 | 
            +
                N2FkODA0YmE0MzVmZjRiN2E4MjMyNGM4YTQzZjYwMWVmYTA5ZmNkOTkwZGVm
         | 
| 10 | 
            +
                NDIyYzYwZDkzOTUzZjc2ZDk1ODlmMjMyNDNjODA1OGFjMzZkMTQ0ZWFkZGQx
         | 
| 11 | 
            +
                YzVlOTY1ZjM3MDk4Njc2NzM2YzBiNjEwMDhmZmYwMDEwMjJmZjY=
         | 
| 12 | 
            +
              data.tar.gz: !binary |-
         | 
| 13 | 
            +
                MDYyYThhNzJiZThjYjZkNzdmMDM0NDgxNDQzYzM0MGU5NGY3MTYxOTZiMWVl
         | 
| 14 | 
            +
                MmE0NjMyOTg2ZmFhODhkM2I0NDdmYzMwMTVkZDQ2ODdkZDdiNTE4MWMxOWU1
         | 
| 15 | 
            +
                OGRkZTg0MjliNGJmMWRiYjlkNDg4YTYzNGI0NWY4Mjk5MWJhNWI=
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module TestHelpers
         | 
| 2 | 
            +
              module Wait
         | 
| 3 | 
            +
                def poll_and_assert(options = {})
         | 
| 4 | 
            +
                  return unless block_given?
         | 
| 5 | 
            +
                  timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
         | 
| 6 | 
            +
                  interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
         | 
| 7 | 
            +
                  end_time = ::Time.now + timeout
         | 
| 8 | 
            +
                  failure = nil
         | 
| 9 | 
            +
                  until ::Time.now > end_time
         | 
| 10 | 
            +
                    begin
         | 
| 11 | 
            +
                      result = yield
         | 
| 12 | 
            +
                      return result if result
         | 
| 13 | 
            +
                    rescue ::RSpec::Expectations::ExpectationNotMetError => e
         | 
| 14 | 
            +
                      failure = e
         | 
| 15 | 
            +
                      sleep interval
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                  raise failure
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                def wait_until(options = {})
         | 
| 22 | 
            +
                  return unless block_given?
         | 
| 23 | 
            +
                  timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
         | 
| 24 | 
            +
                  interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
         | 
| 25 | 
            +
                  error = options[:error] || TestHelpers.configuration.default_error
         | 
| 26 | 
            +
                  end_time = ::Time.now + timeout
         | 
| 27 | 
            +
                  until ::Time.now > end_time
         | 
| 28 | 
            +
                    begin
         | 
| 29 | 
            +
                      result = yield
         | 
| 30 | 
            +
                      return result if result
         | 
| 31 | 
            +
                    rescue ::StandardError
         | 
| 32 | 
            +
                      sleep interval
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
                  result = yield
         | 
| 36 | 
            +
                  return result if result
         | 
| 37 | 
            +
                  raise error
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: test-helpers
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 | 
            -
            - Umair Chagani
         | 
| 7 | 
            +
            - Umair Chagani, Manheim
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| @@ -14,14 +14,14 @@ dependencies: | |
| 14 14 | 
             
              name: rspec
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - '>='
         | 
| 17 | 
            +
                - - ! '>='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '2'
         | 
| 20 20 | 
             
              type: :development
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - '>='
         | 
| 24 | 
            +
                - - ! '>='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '2'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| @@ -39,12 +39,15 @@ dependencies: | |
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 41 | 
             
            description: A collection of helpers.
         | 
| 42 | 
            -
            email: umair.chagani@manheim.com
         | 
| 42 | 
            +
            email: umair.chagani@manheim.com, cloudops@manheim.com
         | 
| 43 43 | 
             
            executables: []
         | 
| 44 44 | 
             
            extensions: []
         | 
| 45 45 | 
             
            extra_rdoc_files: []
         | 
| 46 46 | 
             
            files:
         | 
| 47 | 
            -
            - lib/test-helpers.rb
         | 
| 47 | 
            +
            - lib/test-helpers/all.rb
         | 
| 48 | 
            +
            - lib/test-helpers/test-helpers.rb
         | 
| 49 | 
            +
            - lib/test-helpers/wait.rb
         | 
| 50 | 
            +
            - lib/test-helpers/wait/wait.rb
         | 
| 48 51 | 
             
            homepage: http://github.com/manheim/test-helpers
         | 
| 49 52 | 
             
            licenses:
         | 
| 50 53 | 
             
            - MIT
         | 
| @@ -55,17 +58,17 @@ require_paths: | |
| 55 58 | 
             
            - lib
         | 
| 56 59 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 57 60 | 
             
              requirements:
         | 
| 58 | 
            -
              - - '>='
         | 
| 61 | 
            +
              - - ! '>='
         | 
| 59 62 | 
             
                - !ruby/object:Gem::Version
         | 
| 60 | 
            -
                  version:  | 
| 63 | 
            +
                  version: 1.9.3
         | 
| 61 64 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 62 65 | 
             
              requirements:
         | 
| 63 | 
            -
              - - '>='
         | 
| 66 | 
            +
              - - ! '>='
         | 
| 64 67 | 
             
                - !ruby/object:Gem::Version
         | 
| 65 68 | 
             
                  version: '0'
         | 
| 66 69 | 
             
            requirements: []
         | 
| 67 70 | 
             
            rubyforge_project: 
         | 
| 68 | 
            -
            rubygems_version: 2.4. | 
| 71 | 
            +
            rubygems_version: 2.4.8
         | 
| 69 72 | 
             
            signing_key: 
         | 
| 70 73 | 
             
            specification_version: 4
         | 
| 71 74 | 
             
            summary: Test helpers!
         |