restful_resource 0.10.0 → 0.10.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa9f1b4444d2963c7d5bbd4d9fe269f683c27409
|
4
|
+
data.tar.gz: fcec2e74c07c795c613ff58790e3c6ef7d14bd6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c3387bd767ecfbcaa72e3df34ed255e4580d11a4e8dee539efe08ceaa4275f8fe54a56dab86f4651470a09f9397158b1471a96e6af123366e6fe78193a57106
|
7
|
+
data.tar.gz: ea015503e0f19658d3326a71832f6452aa0e3ad0e711bb94ca914f0a86628d7cf752bc2b0561fd5ad7859dfe67fb0c6ac2315728dfbf293a150844466525414f
|
@@ -8,7 +8,7 @@ module RestfulResource
|
|
8
8
|
module Redirections
|
9
9
|
def self.included(base)
|
10
10
|
base.instance_eval do
|
11
|
-
def post(data: {}, delay: 0
|
11
|
+
def post(data: {}, delay: 1.0, max_attempts: 10, **params)
|
12
12
|
url = collection_url(params)
|
13
13
|
|
14
14
|
response = self.accept_redirected_result(response: http.post(url, data: data), delay: delay, max_attempts: max_attempts)
|
@@ -37,22 +37,22 @@ describe RestfulResource::Redirections do
|
|
37
37
|
expect(subject.test_data).to eq 42
|
38
38
|
end
|
39
39
|
|
40
|
-
it 'should wait 0
|
40
|
+
it 'should wait 1.0 seconds after first redirect' do
|
41
41
|
expected_get_response = RestfulResource::Response.new(body: {test_data: 42}.to_json, status: 200)
|
42
42
|
|
43
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
43
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
44
44
|
expect_get(redirect_target, expected_get_response).ordered
|
45
45
|
|
46
46
|
expect(subject.test_data).to eq 42
|
47
47
|
end
|
48
48
|
|
49
|
-
it 'should wait 0
|
49
|
+
it 'should wait 1.0 seconds between retries' do
|
50
50
|
resource_not_ready_get_response = RestfulResource::Response.new(body: 'pending', status: 202)
|
51
51
|
resource_ready_get_response = RestfulResource::Response.new(body: {test_data: 42}.to_json, status: 200)
|
52
52
|
|
53
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
53
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
54
54
|
expect_get(redirect_target, resource_not_ready_get_response).ordered
|
55
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
55
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
56
56
|
expect_get(redirect_target, resource_ready_get_response).ordered
|
57
57
|
|
58
58
|
expect(subject.test_data).to eq 42
|
@@ -63,10 +63,10 @@ describe RestfulResource::Redirections do
|
|
63
63
|
resource_ready_get_response = RestfulResource::Response.new(body: {test_data: 42}.to_json, status: 200)
|
64
64
|
|
65
65
|
9.times do
|
66
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
66
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
67
67
|
expect_get(redirect_target, resource_not_ready_get_response).ordered
|
68
68
|
end
|
69
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
69
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
70
70
|
expect_get(redirect_target, resource_ready_get_response).ordered
|
71
71
|
|
72
72
|
expect(subject.test_data).to eq 42
|
@@ -77,7 +77,7 @@ describe RestfulResource::Redirections do
|
|
77
77
|
resource_ready_get_response = RestfulResource::Response.new(body: {test_data: 42}.to_json, status: 200)
|
78
78
|
|
79
79
|
11.times do
|
80
|
-
expect(RestfulResource::Redirections).to receive(:wait).with(0
|
80
|
+
expect(RestfulResource::Redirections).to receive(:wait).with(1.0).ordered
|
81
81
|
expect_get(redirect_target, resource_not_ready_get_response).ordered
|
82
82
|
end
|
83
83
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|