yadisk-client 1.10.2 → 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/CI.yml +50 -0
- data/Gemfile.lock +12 -1
- data/README.md +5 -2
- data/lib/yadisk/resources/disk.rb +5 -6
- data/lib/yadisk/version.rb +2 -2
- data/spec/lib/yadisk/client_spec.rb +4 -8
- data/spec/lib/yadisk/disk_spec.rb +220 -217
- data/spec/lib/yadisk/operation_spec.rb +18 -0
- data/spec/lib/yadisk/public_spec.rb +31 -37
- data/spec/lib/yadisk/trash_spec.rb +27 -56
- data/spec/spec_helper.rb +15 -1
- data/spec/vcr/disk/{POST_copy.yml → copy.yml} +10 -8
- data/spec/vcr/disk/create_dir.yml +52 -0
- data/spec/vcr/disk/{PUT_create_dir.yml → create_dir_error_409.yml} +10 -6
- data/spec/vcr/disk/{DELETE_delete.yml → delete.yml} +3 -3
- data/spec/vcr/{operations/GET_status.yml → disk/download.yml} +4 -4
- data/spec/vcr/disk/get_meta.yml +52 -0
- data/spec/vcr/disk/info.yml +57 -0
- data/spec/vcr/disk/last_uploaded.yml +52 -0
- data/spec/vcr/disk/list_files.yml +52 -0
- data/spec/vcr/disk/list_public.yml +52 -0
- data/spec/vcr/disk/{POST_move.yml → move.yml} +10 -8
- data/spec/vcr/disk/{PUT_publish.yml → publish.yml} +4 -4
- data/spec/vcr/disk/{PUT_unpublish.yml → unpublish.yml} +4 -4
- data/spec/vcr/disk/update_meta.yml +54 -0
- data/spec/vcr/disk/{GET_get_meta.yml → upload.yml} +5 -5
- data/spec/vcr/disk/{POST_upload_by_url.yml → upload_by_url.yml} +4 -4
- data/spec/vcr/disk/upload_from_file.yml +111 -0
- data/spec/vcr/{disk/GET_download.yml → operation/status.yml} +4 -4
- data/spec/vcr/{disk/GET_list_public.yml → public/link.yml} +4 -4
- data/spec/vcr/public/meta.yml +52 -0
- data/spec/vcr/public/save.yml +52 -0
- data/spec/vcr/trash/{DELETE_delete.yml → delete.yml} +3 -3
- data/spec/vcr/trash/list.yml +52 -0
- data/spec/vcr/trash/{PUT_restore.yml → restore.yml} +6 -5
- data/spec/vcr_setup.rb +0 -4
- data/yadisk.gemspec +8 -0
- metadata +133 -23
- data/spec/lib/yadisk/errors_spec.rb +0 -16
- data/spec/lib/yadisk/operations_spec.rb +0 -23
- data/spec/vcr/disk/ERROR_info.yml +0 -48
- data/spec/vcr/disk/GET_info.yml +0 -52
- data/spec/vcr/disk/GET_upload.yml +0 -48
- data/spec/vcr/disk/PATCH_update_meta.yml +0 -54
- data/spec/vcr/trash/DELETE_delete_error.yml +0 -49
- data/spec/vcr/trash/GET_list.yml +0 -51
@@ -2,224 +2,227 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
# e2e vars
|
6
|
-
# test_file_path = "spec/test_data/test_file.txt"
|
7
|
-
test_file_name = "remote_file.txt"
|
8
|
-
test_upload_link = ""
|
9
|
-
|
10
5
|
# rubocop:disable Metrics/BlockLength
|
11
|
-
describe
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
6
|
+
RSpec.describe "#disk" do
|
7
|
+
describe ".info" do
|
8
|
+
context "when params is OK" do
|
9
|
+
subject {
|
10
|
+
VCR.use_cassette("disk/info") do
|
11
|
+
@yandex.disk.info
|
12
|
+
end
|
13
|
+
}
|
14
|
+
|
15
|
+
it { expect(subject).to be_instance_of Yadisk::Disk }
|
16
|
+
it { expect(subject.is_paid).to be(true).or be(false) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".create_dir" do
|
21
|
+
context "when creating a directory is OK" do
|
22
|
+
subject {
|
23
|
+
VCR.use_cassette("disk/create_dir") do
|
24
|
+
@yandex.disk.create_dir path: "yadisk_created_dir"
|
25
|
+
end
|
26
|
+
}
|
27
|
+
|
28
|
+
it { expect(subject).to be_an Yadisk::Link }
|
29
|
+
it { expect(subject.href).to eq "https://cloud-api.yandex.net/v1/disk/resources?path=disk%3A%2Fyadisk_created_dir" }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when dir already exists" do
|
33
|
+
subject {
|
34
|
+
VCR.use_cassette("disk/create_dir_error_409") do
|
35
|
+
@yandex.disk.create_dir path: "yadisk_created_dir"
|
36
|
+
end
|
37
|
+
}
|
38
|
+
|
39
|
+
it { expect(subject.error).to eq "DiskPathPointsToExistentDirectoryError" }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".upload" do
|
44
|
+
context "when params is OK" do
|
45
|
+
subject {
|
46
|
+
VCR.use_cassette("disk/upload") do
|
47
|
+
@yandex.disk.upload(path: "yadisk_upload_here")
|
48
|
+
end
|
49
|
+
}
|
50
|
+
|
51
|
+
it { expect(subject).to be_an Yadisk::ResourceUploadLink }
|
52
|
+
it { expect(subject.operation_id).to be_an String }
|
53
|
+
it { expect(subject.href).to match %r{/uploader9x.disk.yandex.net:443/upload-target/} }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".upload_from_file" do
|
58
|
+
context "when params is OK" do
|
59
|
+
subject {
|
60
|
+
VCR.use_cassette("disk/upload_from_file") do
|
61
|
+
@yandex.disk.upload_from_file(
|
62
|
+
upload_link: "https://uploader9x.disk.yandex.net:443/upload-target/20221018T144311.680.utd.6n9ay2kos10pewsoun8tlx7gf-k7o.674502",
|
63
|
+
src: "LICENSE"
|
64
|
+
)
|
65
|
+
end
|
66
|
+
}
|
67
|
+
|
68
|
+
it { expect(subject).to be true }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe ".upload_by_url" do
|
73
|
+
context "when params is OK" do
|
74
|
+
subject {
|
75
|
+
VCR.use_cassette("disk/upload_by_url") do
|
76
|
+
@yandex.disk.upload_by_url(path: "yadisk_test_png.png", url: "https://www.fnordware.com/superpng/pnggrad8rgb.png")
|
77
|
+
end
|
78
|
+
}
|
79
|
+
|
80
|
+
it { expect(subject).to be_an Yadisk::Link }
|
81
|
+
it { expect(subject.href).to be_an String }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe ".update_meta" do
|
86
|
+
context "when params is OK" do
|
87
|
+
subject {
|
88
|
+
VCR.use_cassette("disk/update_meta") do
|
89
|
+
@yandex.disk.update_meta(path: "yadisk_test_png.png", key: "value")
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
it { expect(subject).to be_an Yadisk::Resource }
|
94
|
+
it { expect(subject.custom_properties.key).to eq "value" }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe ".get_meta" do
|
99
|
+
context "when params is OK" do
|
100
|
+
subject {
|
101
|
+
VCR.use_cassette("disk/get_meta") do
|
102
|
+
@yandex.disk.get_meta(path: "yadisk_test_png.png")
|
103
|
+
end
|
104
|
+
}
|
105
|
+
|
106
|
+
it { expect(subject).to be_an Yadisk::Resource }
|
107
|
+
it { expect(subject.custom_properties.key).to eq "value" }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe ".copy" do
|
112
|
+
context "when params is OK" do
|
113
|
+
subject {
|
114
|
+
VCR.use_cassette("disk/copy") do
|
115
|
+
@yandex.disk.copy(from: "yadisk_test_png.png", to: "yadisk_test_png_copy.png")
|
116
|
+
end
|
117
|
+
}
|
118
|
+
|
119
|
+
it { expect(subject).to be_an Yadisk::Link }
|
120
|
+
it { expect(subject.href).to be_an String }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe ".download" do
|
125
|
+
context "when params is OK" do
|
126
|
+
subject {
|
127
|
+
VCR.use_cassette("disk/download") do
|
128
|
+
@yandex.disk.download(path: "yadisk_test_png_copy.png")
|
129
|
+
end
|
130
|
+
}
|
131
|
+
|
132
|
+
it { expect(subject).to be_an Yadisk::Link }
|
133
|
+
it { expect(subject.href).to be_an String }
|
134
|
+
it { expect(subject.href).not_to be nil }
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe ".list_files" do
|
139
|
+
let(:limit) { "1" }
|
140
|
+
context "with limit param" do
|
141
|
+
subject {
|
142
|
+
VCR.use_cassette("disk/list_files") do
|
143
|
+
@yandex.disk.list_files(limit: limit)
|
144
|
+
end
|
145
|
+
}
|
146
|
+
|
147
|
+
it { expect(subject).to be_an Yadisk::Collection }
|
148
|
+
it { expect(subject.data.first).to be_an Yadisk::Resource }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe ".last_uploaded" do
|
153
|
+
context "whith limit param" do
|
154
|
+
subject {
|
155
|
+
VCR.use_cassette("disk/last_uploaded") do
|
156
|
+
@yandex.disk.last_uploaded(limit: 1)
|
157
|
+
end
|
158
|
+
}
|
159
|
+
|
160
|
+
it { expect(subject).to be_an Yadisk::Collection }
|
161
|
+
it { expect(subject.data.first).to be_an Yadisk::Resource }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe ".move" do
|
166
|
+
context "when params is OK" do
|
167
|
+
subject {
|
168
|
+
VCR.use_cassette("disk/move") do
|
169
|
+
@yandex.disk.move(from: "yadisk_test_png_copy.png", to: "yadisk.png")
|
170
|
+
end
|
171
|
+
}
|
172
|
+
|
173
|
+
it { expect(subject).to be_an Yadisk::Link }
|
174
|
+
it { expect(subject.href).to be_an String }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe ".list_public" do
|
179
|
+
context "whit limit param" do
|
180
|
+
subject {
|
181
|
+
VCR.use_cassette("disk/list_public") do
|
182
|
+
@yandex.disk.list_public(limit: 1)
|
183
|
+
end
|
184
|
+
}
|
185
|
+
|
186
|
+
it { expect(subject).to be_an Yadisk::Collection }
|
187
|
+
it { expect(subject.data.first).to be_an Yadisk::PublicResource }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe ".publish" do
|
192
|
+
context "when params is OK" do
|
193
|
+
subject {
|
194
|
+
VCR.use_cassette("disk/publish") do
|
195
|
+
@yandex.disk.publish(path: "yadisk.png")
|
196
|
+
end
|
197
|
+
}
|
198
|
+
|
199
|
+
it { expect(subject).to be_an Yadisk::Link }
|
200
|
+
it { expect(subject.href).to be_an String }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe ".unpublish" do
|
205
|
+
context "when params is OK" do
|
206
|
+
subject {
|
207
|
+
VCR.use_cassette("disk/unpublish") do
|
208
|
+
@yandex.disk.unpublish(path: "yadisk.png")
|
209
|
+
end
|
210
|
+
}
|
211
|
+
|
212
|
+
it { expect(subject).to be_an Yadisk::Link }
|
213
|
+
it { expect(subject.href).to be_an String }
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe ".delete" do
|
218
|
+
context "when params is OK" do
|
219
|
+
subject {
|
220
|
+
VCR.use_cassette("disk/delete") do
|
221
|
+
@yandex.disk.delete(path: "yadisk_test_png.png")
|
222
|
+
end
|
223
|
+
}
|
224
|
+
|
225
|
+
it { expect(subject).to be_an Yadisk::Object }
|
223
226
|
end
|
224
227
|
end
|
225
228
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe "#operation" do
|
6
|
+
describe ".status" do
|
7
|
+
context "when params is OK" do
|
8
|
+
subject {
|
9
|
+
VCR.use_cassette("operation/status") do
|
10
|
+
@yandex.operation.status operation_id: "78ccc91b3a034a941a72dde1ae92fbf26d0facf9bad941eee9b432f4abdfdd1e"
|
11
|
+
end
|
12
|
+
}
|
13
|
+
|
14
|
+
it { expect(subject).to be_an String }
|
15
|
+
it { expect(subject).to eq "success" }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,50 +2,44 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
CassetteHelpers::Use.new(name) do |c|
|
15
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/operations/#{id}")
|
16
|
-
expect(c.code).to eq(200)
|
17
|
-
expect(c.method).to eq("get")
|
5
|
+
# rubocop:disable Metrics/BlockLength
|
6
|
+
RSpec.describe "#public" do
|
7
|
+
let(:public_url) { "https://disk.yandex.ru/d/XzWAb9JaK605ig" }
|
8
|
+
|
9
|
+
describe ".meta" do
|
10
|
+
context "when params is OK" do
|
11
|
+
subject {
|
12
|
+
VCR.use_cassette("public/meta") do
|
13
|
+
@yandex.public_resource.meta public_url: public_url
|
18
14
|
end
|
19
|
-
|
20
|
-
|
15
|
+
}
|
16
|
+
|
17
|
+
it { expect(subject).to be_an Yadisk::PublicResource }
|
21
18
|
end
|
19
|
+
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
CassetteHelpers::Use.new(name) do |c|
|
29
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/operations/#{id}")
|
30
|
-
expect(c.code).to eq(200)
|
31
|
-
expect(c.method).to eq("get")
|
21
|
+
describe ".link" do
|
22
|
+
context "when params is OK" do
|
23
|
+
subject {
|
24
|
+
VCR.use_cassette("public/link") do
|
25
|
+
@yandex.public_resource.link public_url: public_url
|
32
26
|
end
|
33
|
-
|
34
|
-
|
27
|
+
}
|
28
|
+
|
29
|
+
it { expect(subject).to be_an Yadisk::Link }
|
35
30
|
end
|
31
|
+
end
|
36
32
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
CassetteHelpers::Use.new(name) do |c|
|
43
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/operations/#{id}")
|
44
|
-
expect(c.code).to eq(200)
|
45
|
-
expect(c.method).to eq("post")
|
33
|
+
describe ".save" do
|
34
|
+
context "when params is OK" do
|
35
|
+
subject {
|
36
|
+
VCR.use_cassette("public/save") do
|
37
|
+
@yandex.public_resource.save public_url: public_url
|
46
38
|
end
|
47
|
-
|
48
|
-
|
39
|
+
}
|
40
|
+
|
41
|
+
it { expect(subject).to be_an Yadisk::Link }
|
49
42
|
end
|
50
43
|
end
|
51
44
|
end
|
45
|
+
# rubocop:enable Metrics/BlockLength
|
@@ -2,71 +2,42 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
CassetteHelpers::Use.new(name).url do |c|
|
13
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/trash/resources")
|
14
|
-
expect(c.code).to eq(200)
|
15
|
-
expect(c.method).to eq("get")
|
5
|
+
# rubocop:disable Metrics/BlockLength
|
6
|
+
RSpec.describe "#trash" do
|
7
|
+
describe ".delete" do
|
8
|
+
context "when params is OK" do
|
9
|
+
subject {
|
10
|
+
VCR.use_cassette("trash/delete") do
|
11
|
+
@yandex.trash.delete path: "yadisk_created_dir_12b63824b98bc5eb70d25c703cfc3224a46e6896"
|
16
12
|
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
13
|
+
}
|
20
14
|
|
21
|
-
|
22
|
-
name = "trash/GET_list"
|
23
|
-
VCR.use_cassette(name, allow_playback_repeats: true) do
|
24
|
-
resp = @yandex.trash.list(path: file_path)
|
25
|
-
CassetteHelpers::Use.new(name).url do |c|
|
26
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/trash/resources")
|
27
|
-
expect(c.code).to eq(200)
|
28
|
-
expect(c.method).to eq("get")
|
29
|
-
end
|
30
|
-
expect(resp).to be_instance_of(Yadisk::TrashResource)
|
31
|
-
end
|
15
|
+
it { expect(subject).to be_an Yadisk::Link }
|
32
16
|
end
|
17
|
+
end
|
33
18
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/resources?path=remote_path.txt")
|
40
|
-
expect(c.code).to eq(204)
|
41
|
-
expect(c.method).to eq("put")
|
19
|
+
describe ".list" do
|
20
|
+
context "when params is OK" do
|
21
|
+
subject {
|
22
|
+
VCR.use_cassette("trash/list") do
|
23
|
+
@yandex.trash.list path: ""
|
42
24
|
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
25
|
+
}
|
46
26
|
|
47
|
-
|
48
|
-
name = "trash/DELETE_delete"
|
49
|
-
VCR.use_cassette(name, allow_playback_repeats: true) do
|
50
|
-
resp = @yandex.trash.delete(path: "trash:/remote_file.txt_f7fc32168f3b30e60994fd2e82af7d230dab5c91")
|
51
|
-
CassetteHelpers::Use.new(name) do |c|
|
52
|
-
expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/trash/resources")
|
53
|
-
expect(c.code).to eq(200)
|
54
|
-
expect(c.method).to eq("delete")
|
55
|
-
end
|
56
|
-
expect(resp).to be_instance_of(Yadisk::Link)
|
57
|
-
end
|
27
|
+
it { expect(subject).to be_an Yadisk::TrashResource }
|
58
28
|
end
|
29
|
+
end
|
59
30
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
VCR.use_cassette(name, allow_playback_repeats: true) do
|
66
|
-
expect { request }.to raise_error(Yadisk::Error)
|
67
|
-
.with_message(/DiskNotFoundError/)
|
31
|
+
describe ".restore" do
|
32
|
+
context "when params is OK" do
|
33
|
+
subject {
|
34
|
+
VCR.use_cassette("trash/restore") do
|
35
|
+
@yandex.trash.restore path: "yadisk_created_dir_857c8d0feba033c7559ade2c7c07fef3ae41c046"
|
68
36
|
end
|
69
|
-
|
37
|
+
}
|
38
|
+
|
39
|
+
it { expect(subject).to be_an Yadisk::Link }
|
70
40
|
end
|
71
41
|
end
|
72
42
|
end
|
43
|
+
# rubocop:enable Metrics/BlockLength
|