fbe 0.0.25 → 0.0.27

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
  SHA256:
3
- metadata.gz: 271cf18aec3c0815566d0e437d10e0bed25949388ceadb0249090cefc7018beb
4
- data.tar.gz: 14e1b474c174ef2a7ee2170b5feae6ddee90f9c9faf789f05f1efe8aaab7427b
3
+ metadata.gz: 0b7ed70e3e3d37780d727b9c269cd27a86179da0df8b781eb2cc8a339e443ac5
4
+ data.tar.gz: 9635ce676a24efc7e63567d0b370588a4b8af12de34cbcc65bb5718991658c8e
5
5
  SHA512:
6
- metadata.gz: 5295f5e731076ab568869329a52ecf91289c049e83e22de834c7692302eb19aec6f6bd7fc1e3c2216b0e728620d2a31fd77bc55d091f98cbf036d981bbcdeedb
7
- data.tar.gz: 7303c455a7f1b244c61bc33b4762383aca458b7f76cc3d9ca11bd6ad0158791c934cf02e8f53b8073b4e2a949b8b98a2685966a815ce3fd846973f74a65984c9
6
+ metadata.gz: 5dfd3ace2f914dc4fa31869a743b41fd56851419f32e2d0b1077b1517b9faa9e8829ecc2c545653162161c0722856019ea112411133ec7c79a065eb046f376b1
7
+ data.tar.gz: 87ffa308115144cf84cb725e084917473dce9ab3f73bca02dc2e231d160c74fb0a46cd4676791c0891d25b5406dc95f0313d08ffda13c8e6ff903fc625570798
data/Rakefile CHANGED
@@ -32,6 +32,8 @@ def version
32
32
  Gem::Specification.load(Dir['*.gemspec'].first).version
33
33
  end
34
34
 
35
+ ENV['RACK_ENV'] = 'test'
36
+
35
37
  task default: %i[clean test rubocop yard copyright]
36
38
 
37
39
  require 'rake/testtask'
data/lib/fbe/octo.rb CHANGED
@@ -59,8 +59,11 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
59
59
  stack = Faraday::RackBuilder.new do |builder|
60
60
  builder.use(
61
61
  Faraday::Retry::Middleware,
62
- exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::TooManyRequests],
63
- max: 5, interval: 1
62
+ exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::Error],
63
+ max: 5,
64
+ interval: ENV['RACK_ENV'] == 'test' ? 0.1 : 10,
65
+ methods: [:get],
66
+ backoff_factor: 2
64
67
  )
65
68
  builder.use(Faraday::HttpCache, serializer: Marshal, shared_cache: false, logger: Loog::NULL)
66
69
  builder.use(Octokit::Response::RaiseError)
@@ -142,7 +145,7 @@ class Fbe::FakeOctokit
142
145
  }
143
146
  end
144
147
 
145
- def repository_workflow_runs(repo)
148
+ def repository_workflow_runs(repo, _opts = {})
146
149
  {
147
150
  total_count: 2,
148
151
  workflow_runs: [
@@ -167,7 +170,7 @@ class Fbe::FakeOctokit
167
170
  }
168
171
  end
169
172
 
170
- def releases(_repo)
173
+ def releases(_repo, _opts = {})
171
174
  [
172
175
  release('https://github...'),
173
176
  release('https://gith')
data/lib/fbe.rb CHANGED
@@ -27,5 +27,5 @@
27
27
  # License:: MIT
28
28
  module Fbe
29
29
  # Current version of the gem (changed by .rultor.yml on every release)
30
- VERSION = '0.0.25'
30
+ VERSION = '0.0.27'
31
31
  end
@@ -80,6 +80,18 @@ class TestOcto < Minitest::Test
80
80
  o.user('yegor256')
81
81
  end
82
82
 
83
+ def test_retrying_on_error_response
84
+ WebMock.disable_net_connect!
85
+ global = {}
86
+ o = Fbe.octo(loog: Loog::NULL, global:, options: Judges::Options.new)
87
+ stub_request(:get, 'https://api.github.com/users/yegor256')
88
+ .to_return(status: 503)
89
+ .times(1)
90
+ .then
91
+ .to_return(status: 200, body: '{}')
92
+ o.user('yegor256')
93
+ end
94
+
83
95
  def test_with_broken_token
84
96
  skip # it's a "live" test, run it manually if you need it
85
97
  WebMock.enable_net_connect!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko