attempt_this 1.0.1 → 1.0.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
- data/.gitignore +2 -0
- data/.travis.yml +4 -2
- data/attempt_this.gemspec +5 -2
- data/lib/attempt_this/attempt_object.rb +2 -2
- data/lib/attempt_this/attempt_this.rb +1 -1
- data/spec/attempt_spec.rb +14 -14
- metadata +35 -36
- data/Gemfile.lock +0 -37
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 83df19bd5875cc762ac6ccfd2b5eb5437e628b2b
         | 
| 4 | 
            +
              data.tar.gz: a26d7b65ee324362bb40ec2b6f8ebdd4da31fe10
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 319f272fe569aeaec701302f1486225b38cfa52a74471a82c2cc2766e834c95965dba516e2cd6a7353e1ec16a663311630fe701438175e1b80d37ffdcf58dd44
         | 
| 7 | 
            +
              data.tar.gz: ed61e7e66bc8c9c484af9d2422232eb0d345b0134c22c518a5f5a206fc5570e62463af511848e23d745cdf6bfa55ac5056229573b6bd492ebfacd670264eeb22
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    CHANGED
    
    
    
        data/attempt_this.gemspec
    CHANGED
    
    | @@ -1,7 +1,10 @@ | |
| 1 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 2 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            Gem::Specification.new do |s|
         | 
| 2 5 | 
             
              s.name        = 'attempt_this'
         | 
| 3 | 
            -
              s.version     = '1.0. | 
| 4 | 
            -
              s.date        = ' | 
| 6 | 
            +
              s.version     = '1.0.2'
         | 
| 7 | 
            +
              s.date        = '2015-06-22'
         | 
| 5 8 | 
             
              s.summary     = 'Retry policy mix-in'
         | 
| 6 9 | 
             
              s.description = <<EOM
         | 
| 7 10 | 
             
            Retry policy mix-in with configurable number of attempts, delays, exception filters, and fall back strategies.
         | 
    
        data/spec/attempt_spec.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ describe AttemptThis do | |
| 15 15 | 
             
                it 'should execute code block' do
         | 
| 16 16 | 
             
                  was_called = false
         | 
| 17 17 | 
             
                  attempt(1.times) {was_called = true}
         | 
| 18 | 
            -
                  was_called.should  | 
| 18 | 
            +
                  was_called.should be true
         | 
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 21 | 
             
                it 'should execute the code block only once' do
         | 
| @@ -87,7 +87,7 @@ describe AttemptThis do | |
| 87 87 | 
             
                  attempt(3.times).with_delay(1) do
         | 
| 88 88 | 
             
                    was_called = true
         | 
| 89 89 | 
             
                  end
         | 
| 90 | 
            -
                  was_called.should  | 
| 90 | 
            +
                  was_called.should be true
         | 
| 91 91 | 
             
                end
         | 
| 92 92 |  | 
| 93 93 | 
             
                it 'should not sleep on success' do
         | 
| @@ -151,7 +151,7 @@ describe AttemptThis do | |
| 151 151 | 
             
                  was_called = false
         | 
| 152 152 | 
             
                  attempt(1.times).with_reset(lambda{}) { was_called = true }
         | 
| 153 153 |  | 
| 154 | 
            -
                  was_called.should  | 
| 154 | 
            +
                  was_called.should be true
         | 
| 155 155 | 
             
                end
         | 
| 156 156 |  | 
| 157 157 | 
             
                it 'should reject multiple reset procs' do
         | 
| @@ -162,7 +162,7 @@ describe AttemptThis do | |
| 162 162 | 
             
                  was_called = false
         | 
| 163 163 |  | 
| 164 164 | 
             
                  attempt(1.times).with_reset(lambda{ was_called = true }) {}
         | 
| 165 | 
            -
                  was_called.should  | 
| 165 | 
            +
                  was_called.should be false
         | 
| 166 166 | 
             
                end
         | 
| 167 167 |  | 
| 168 168 | 
             
                it 'should be called on each failure' do
         | 
| @@ -190,13 +190,13 @@ describe AttemptThis do | |
| 190 190 | 
             
                  was_called = false
         | 
| 191 191 | 
             
                  attempt(3.times).and_default_to(lambda{}){ was_called = true }
         | 
| 192 192 |  | 
| 193 | 
            -
                  was_called.should  | 
| 193 | 
            +
                  was_called.should be true
         | 
| 194 194 | 
             
                end
         | 
| 195 195 |  | 
| 196 196 | 
             
                it 'should not be called on success' do
         | 
| 197 197 | 
             
                  was_called = false
         | 
| 198 198 | 
             
                  attempt(3.times).and_default_to(lambda{ was_called = true }) {}
         | 
| 199 | 
            -
                  was_called.should  | 
| 199 | 
            +
                  was_called.should be false
         | 
| 200 200 | 
             
                end
         | 
| 201 201 |  | 
| 202 202 | 
             
                it 'should be called once on the failure' do
         | 
| @@ -211,7 +211,7 @@ describe AttemptThis do | |
| 211 211 | 
             
                  was_called = false
         | 
| 212 212 |  | 
| 213 213 | 
             
                  attempt(3.times).and_default_to(lambda{ was_called = true }) { call_count += 1; raise 'Test' if call_count < 2 }
         | 
| 214 | 
            -
                  was_called.should  | 
| 214 | 
            +
                  was_called.should be false
         | 
| 215 215 | 
             
                end
         | 
| 216 216 | 
             
              end
         | 
| 217 217 |  | 
| @@ -244,7 +244,7 @@ describe AttemptThis do | |
| 244 244 | 
             
                  was_called = false
         | 
| 245 245 |  | 
| 246 246 | 
             
                  attempt(3.times).with_binary_backoff(1) { was_called = true }
         | 
| 247 | 
            -
                  was_called.should  | 
| 247 | 
            +
                  was_called.should be true
         | 
| 248 248 | 
             
                end
         | 
| 249 249 |  | 
| 250 250 | 
             
                it 'should double delay on each failure' do
         | 
| @@ -272,7 +272,7 @@ describe AttemptThis do | |
| 272 272 | 
             
                it 'should call code within the block' do
         | 
| 273 273 | 
             
                  was_called = false
         | 
| 274 274 | 
             
                  attempt(2.times).with_filter(Exception){ was_called = true }
         | 
| 275 | 
            -
                  was_called.should  | 
| 275 | 
            +
                  was_called.should be true
         | 
| 276 276 | 
             
                end
         | 
| 277 277 |  | 
| 278 278 | 
             
                it 'should ignore other exceptions' do
         | 
| @@ -302,29 +302,29 @@ describe AttemptThis do | |
| 302 302 | 
             
                subject{TestAttempt.new}
         | 
| 303 303 |  | 
| 304 304 | 
             
                it 'should be true initially' do
         | 
| 305 | 
            -
                  subject.enabled?.should  | 
| 305 | 
            +
                  subject.enabled?.should be true
         | 
| 306 306 | 
             
                end
         | 
| 307 307 |  | 
| 308 308 | 
             
                it 'should accept true' do
         | 
| 309 309 | 
             
                  subject.enabled = true
         | 
| 310 | 
            -
                  subject.enabled?.should  | 
| 310 | 
            +
                  subject.enabled?.should be true
         | 
| 311 311 | 
             
                end
         | 
| 312 312 |  | 
| 313 313 | 
             
                it 'should accept false' do
         | 
| 314 314 | 
             
                  subject.enabled = false
         | 
| 315 | 
            -
                  subject.enabled?.should  | 
| 315 | 
            +
                  subject.enabled?.should be false
         | 
| 316 316 | 
             
                end
         | 
| 317 317 |  | 
| 318 318 | 
             
                it 'should change from true to false' do
         | 
| 319 319 | 
             
                  subject.enabled = true
         | 
| 320 320 | 
             
                  subject.enabled = false
         | 
| 321 | 
            -
                  subject.enabled?.should  | 
| 321 | 
            +
                  subject.enabled?.should be false
         | 
| 322 322 | 
             
                end
         | 
| 323 323 |  | 
| 324 324 | 
             
                it 'should change from false to true' do
         | 
| 325 325 | 
             
                  subject.enabled = false
         | 
| 326 326 | 
             
                  subject.enabled = true
         | 
| 327 | 
            -
                  subject.enabled?.should  | 
| 327 | 
            +
                  subject.enabled?.should be true
         | 
| 328 328 | 
             
                end
         | 
| 329 329 |  | 
| 330 330 | 
             
                context 'when disabled' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,71 +1,71 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: attempt_this
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aliaksei Baturytski
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-06-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| 15 | 
            -
               | 
| 15 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 17 | 
            +
                - - ~>
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '1.6'
         | 
| 20 | 
            -
               | 
| 21 | 
            -
              prerelease: false
         | 
| 22 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 20 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 23 21 | 
             
                requirements:
         | 
| 24 | 
            -
                - -  | 
| 22 | 
            +
                - - ~>
         | 
| 25 23 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 24 | 
             
                    version: '1.6'
         | 
| 25 | 
            +
              prerelease: false
         | 
| 26 | 
            +
              type: :development
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: rake
         | 
| 29 | 
            -
               | 
| 29 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - -  | 
| 31 | 
            +
                - - ~>
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: '10.1'
         | 
| 34 | 
            -
               | 
| 35 | 
            -
              prerelease: false
         | 
| 36 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 34 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 37 35 | 
             
                requirements:
         | 
| 38 | 
            -
                - -  | 
| 36 | 
            +
                - - ~>
         | 
| 39 37 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 38 | 
             
                    version: '10.1'
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              type: :development
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: rspec
         | 
| 43 | 
            -
               | 
| 43 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - -  | 
| 45 | 
            +
                - - ~>
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: '2.13'
         | 
| 48 | 
            -
               | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 48 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 51 49 | 
             
                requirements:
         | 
| 52 | 
            -
                - -  | 
| 50 | 
            +
                - - ~>
         | 
| 53 51 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 52 | 
             
                    version: '2.13'
         | 
| 53 | 
            +
              prerelease: false
         | 
| 54 | 
            +
              type: :development
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: simplecov
         | 
| 57 | 
            -
               | 
| 57 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 59 | 
            +
                - - ~>
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 61 | 
             
                    version: '0.8'
         | 
| 62 | 
            -
               | 
| 63 | 
            -
              prerelease: false
         | 
| 64 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 62 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 63 | 
             
                requirements:
         | 
| 66 | 
            -
                - -  | 
| 64 | 
            +
                - - ~>
         | 
| 67 65 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 66 | 
             
                    version: '0.8'
         | 
| 67 | 
            +
              prerelease: false
         | 
| 68 | 
            +
              type: :development
         | 
| 69 69 | 
             
            description: |
         | 
| 70 70 | 
             
              Retry policy mix-in with configurable number of attempts, delays, exception filters, and fall back strategies.
         | 
| 71 71 |  | 
| @@ -75,10 +75,9 @@ executables: [] | |
| 75 75 | 
             
            extensions: []
         | 
| 76 76 | 
             
            extra_rdoc_files: []
         | 
| 77 77 | 
             
            files:
         | 
| 78 | 
            -
            -  | 
| 79 | 
            -
            -  | 
| 78 | 
            +
            - .gitignore
         | 
| 79 | 
            +
            - .travis.yml
         | 
| 80 80 | 
             
            - Gemfile
         | 
| 81 | 
            -
            - Gemfile.lock
         | 
| 82 81 | 
             
            - README.md
         | 
| 83 82 | 
             
            - Rakefile
         | 
| 84 83 | 
             
            - attempt_this.gemspec
         | 
| @@ -94,24 +93,24 @@ homepage: https://github.com/aliakb/attempt_this | |
| 94 93 | 
             
            licenses:
         | 
| 95 94 | 
             
            - MIT
         | 
| 96 95 | 
             
            metadata: {}
         | 
| 97 | 
            -
            post_install_message: | 
| 96 | 
            +
            post_install_message:
         | 
| 98 97 | 
             
            rdoc_options: []
         | 
| 99 98 | 
             
            require_paths:
         | 
| 100 99 | 
             
            - lib
         | 
| 101 100 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 102 101 | 
             
              requirements:
         | 
| 103 | 
            -
              - -  | 
| 102 | 
            +
              - - '>='
         | 
| 104 103 | 
             
                - !ruby/object:Gem::Version
         | 
| 105 104 | 
             
                  version: 1.8.7
         | 
| 106 105 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 107 106 | 
             
              requirements:
         | 
| 108 | 
            -
              - -  | 
| 107 | 
            +
              - - '>='
         | 
| 109 108 | 
             
                - !ruby/object:Gem::Version
         | 
| 110 109 | 
             
                  version: '0'
         | 
| 111 110 | 
             
            requirements: []
         | 
| 112 | 
            -
            rubyforge_project: | 
| 113 | 
            -
            rubygems_version: 2. | 
| 114 | 
            -
            signing_key: | 
| 111 | 
            +
            rubyforge_project:
         | 
| 112 | 
            +
            rubygems_version: 2.4.5
         | 
| 113 | 
            +
            signing_key:
         | 
| 115 114 | 
             
            specification_version: 4
         | 
| 116 115 | 
             
            summary: Retry policy mix-in
         | 
| 117 116 | 
             
            test_files: []
         | 
    
        data/Gemfile.lock
    DELETED
    
    | @@ -1,37 +0,0 @@ | |
| 1 | 
            -
            PATH
         | 
| 2 | 
            -
              remote: .
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                attempt_this (1.0.1)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            GEM
         | 
| 7 | 
            -
              remote: http://rubygems.org/
         | 
| 8 | 
            -
              specs:
         | 
| 9 | 
            -
                diff-lcs (1.2.4)
         | 
| 10 | 
            -
                docile (1.1.2)
         | 
| 11 | 
            -
                multi_json (1.8.4)
         | 
| 12 | 
            -
                rake (10.1.1)
         | 
| 13 | 
            -
                rspec (2.13.0)
         | 
| 14 | 
            -
                  rspec-core (~> 2.13.0)
         | 
| 15 | 
            -
                  rspec-expectations (~> 2.13.0)
         | 
| 16 | 
            -
                  rspec-mocks (~> 2.13.0)
         | 
| 17 | 
            -
                rspec-core (2.13.1)
         | 
| 18 | 
            -
                rspec-expectations (2.13.0)
         | 
| 19 | 
            -
                  diff-lcs (>= 1.1.3, < 2.0)
         | 
| 20 | 
            -
                rspec-mocks (2.13.1)
         | 
| 21 | 
            -
                simplecov (0.8.2)
         | 
| 22 | 
            -
                  docile (~> 1.1.0)
         | 
| 23 | 
            -
                  multi_json
         | 
| 24 | 
            -
                  simplecov-html (~> 0.8.0)
         | 
| 25 | 
            -
                simplecov-html (0.8.0)
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            PLATFORMS
         | 
| 28 | 
            -
              java
         | 
| 29 | 
            -
              ruby
         | 
| 30 | 
            -
              x86-mingw32
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            DEPENDENCIES
         | 
| 33 | 
            -
              attempt_this!
         | 
| 34 | 
            -
              bundler (~> 1.6)
         | 
| 35 | 
            -
              rake (~> 10.1)
         | 
| 36 | 
            -
              rspec (~> 2.13)
         | 
| 37 | 
            -
              simplecov (~> 0.8)
         |