sibit 0.19.1 → 0.19.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/lib/sibit/bestof.rb +2 -2
- data/lib/sibit/firstof.rb +2 -2
- data/lib/sibit/version.rb +1 -1
- data/test/test_bestof.rb +12 -0
- data/test/test_firstof.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db71c5de986c5aeacfb60ddde907c84eade4b53e2b764f513cd6ea20c7a95c45
|
|
4
|
+
data.tar.gz: c79bc1c5b9c544bcc16a61fff3912f09dd5b05152d5cbf667b418d5207d37575
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 951c554ef902b64007c6807976c99f44f909a28730bff366135d5fb2728cae935df206fd065f9500d4f885982c10175c9775ba3001bb37de42ad2f2969dd45ee
|
|
7
|
+
data.tar.gz: b60396b85498717187962637e00008b394eddcb030cdfb5839b3d043bfc086974f05f638057940f621ab1d7d60016857ed19d7bb0354325adcd3e5ebc964f3da
|
data/lib/sibit/bestof.rb
CHANGED
|
@@ -110,8 +110,8 @@ class Sibit
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
if results.empty?
|
|
113
|
-
raise Sibit::Error, "No APIs out of #{@
|
|
114
|
-
#{@
|
|
113
|
+
raise Sibit::Error, "No APIs out of #{@list.length} managed to succeed at #{method}(): \
|
|
114
|
+
#{@list.map { |a| a.class.name }.join(', ')}"
|
|
115
115
|
end
|
|
116
116
|
results.group_by(&:to_s).values.max_by(&:size)[0]
|
|
117
117
|
end
|
data/lib/sibit/firstof.rb
CHANGED
|
@@ -113,8 +113,8 @@ class Sibit
|
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
unless done
|
|
116
|
-
raise Sibit::Error, "No APIs out of #{@
|
|
117
|
-
#{@
|
|
116
|
+
raise Sibit::Error, "No APIs out of #{@list.length} managed to succeed at #{method}(): \
|
|
117
|
+
#{@list.map { |a| a.class.name }.join(', ')}"
|
|
118
118
|
end
|
|
119
119
|
result
|
|
120
120
|
end
|
data/lib/sibit/version.rb
CHANGED
data/test/test_bestof.rb
CHANGED
|
@@ -47,4 +47,16 @@ class TestBestOf < Minitest::Test
|
|
|
47
47
|
assert_equal(64, sibit.latest.length)
|
|
48
48
|
assert_equal(12, sibit.fees[:S])
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
def test_all_fail
|
|
52
|
+
api = Class.new do
|
|
53
|
+
def latest
|
|
54
|
+
raise Sibit::Error, 'intentionally'
|
|
55
|
+
end
|
|
56
|
+
end.new
|
|
57
|
+
sibit = Sibit::BestOf.new([api, api])
|
|
58
|
+
assert_raises Sibit::Error do
|
|
59
|
+
sibit.latest
|
|
60
|
+
end
|
|
61
|
+
end
|
|
50
62
|
end
|
data/test/test_firstof.rb
CHANGED
|
@@ -47,4 +47,16 @@ class TestFirstOf < Minitest::Test
|
|
|
47
47
|
assert_equal(64, sibit.latest.length)
|
|
48
48
|
assert_equal(12, sibit.fees[:S])
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
def test_all_fail
|
|
52
|
+
api = Class.new do
|
|
53
|
+
def latest
|
|
54
|
+
raise Sibit::Error, 'intentionally'
|
|
55
|
+
end
|
|
56
|
+
end.new
|
|
57
|
+
sibit = Sibit::FirstOf.new([api, api])
|
|
58
|
+
assert_raises Sibit::Error do
|
|
59
|
+
sibit.latest
|
|
60
|
+
end
|
|
61
|
+
end
|
|
50
62
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sibit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.19.
|
|
4
|
+
version: 0.19.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backtrace
|