kintone 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.rubocop.yml +11 -1
- data/.travis.yml +15 -1
- data/Guardfile +2 -2
- data/README.md +4 -0
- data/kintone.gemspec +3 -5
- data/lib/kintone/api.rb +18 -24
- data/lib/kintone/api/guest.rb +6 -2
- data/lib/kintone/command/accessor.rb +1 -1
- data/lib/kintone/command/guests.rb +1 -1
- data/lib/kintone/command/record.rb +1 -1
- data/lib/kintone/command/records.rb +3 -2
- data/lib/kintone/kintone_error.rb +11 -0
- data/lib/kintone/query.rb +1 -1
- data/lib/kintone/version.rb +1 -1
- data/spec/kintone/api/guest_spec.rb +98 -10
- data/spec/kintone/api_spec.rb +186 -75
- data/spec/kintone/command/apis_spec.rb +70 -8
- data/spec/kintone/command/app_acl_spec.rb +21 -6
- data/spec/kintone/command/app_spec.rb +22 -2
- data/spec/kintone/command/apps_spec.rb +25 -2
- data/spec/kintone/command/bulk_request_spec.rb +22 -2
- data/spec/kintone/command/field_acl_spec.rb +25 -7
- data/spec/kintone/command/file_spec.rb +28 -12
- data/spec/kintone/command/form_spec.rb +23 -6
- data/spec/kintone/command/guests_spec.rb +44 -4
- data/spec/kintone/command/record_acl_spec.rb +27 -8
- data/spec/kintone/command/record_spec.rb +77 -10
- data/spec/kintone/command/records_spec.rb +157 -15
- data/spec/kintone/command/space_body_spec.rb +25 -7
- data/spec/kintone/command/space_guests_spec.rb +22 -2
- data/spec/kintone/command/space_members_spec.rb +47 -13
- data/spec/kintone/command/space_spec.rb +49 -19
- data/spec/kintone/command/space_thread_spec.rb +26 -2
- data/spec/kintone/command/template_space_spec.rb +37 -20
- data/spec/kintone/kintone_error_spec.rb +22 -0
- data/spec/spec_helper.rb +3 -0
- metadata +17 -27
@@ -9,6 +9,7 @@ describe Kintone::Command::Records do
|
|
9
9
|
|
10
10
|
describe '#get' do
|
11
11
|
subject { target.get(app, query, fields) }
|
12
|
+
|
12
13
|
let(:app) { 8 }
|
13
14
|
let(:query) { '' }
|
14
15
|
let(:fields) { [] }
|
@@ -19,8 +20,11 @@ describe Kintone::Command::Records do
|
|
19
20
|
:get,
|
20
21
|
'https://example.cybozu.com/k/v1/records.json?app=8&query='
|
21
22
|
)
|
22
|
-
.to_return(
|
23
|
-
|
23
|
+
.to_return(
|
24
|
+
body: response_data.to_json,
|
25
|
+
status: 200,
|
26
|
+
headers: { 'Content-type' => 'application/json' }
|
27
|
+
)
|
24
28
|
end
|
25
29
|
|
26
30
|
def response_data
|
@@ -36,11 +40,14 @@ describe Kintone::Command::Records do
|
|
36
40
|
:get,
|
37
41
|
'https://example.cybozu.com/k/v1/records.json?app=8&query=updated_time%20%3e%20%222012%2d02%2d03T09%3a00%3a00%2b0900%22%20and%20updated_time%20%3c%20%222012%2d02%2d03T10%3a00%3a00%2b0900%22'
|
38
42
|
)
|
39
|
-
.to_return(
|
40
|
-
|
43
|
+
.to_return(
|
44
|
+
body: response_data.to_json,
|
45
|
+
status: 200,
|
46
|
+
headers: { 'Content-type' => 'application/json' }
|
47
|
+
)
|
41
48
|
end
|
42
49
|
|
43
|
-
let(:query) {
|
50
|
+
let(:query) { 'updated_time > "2012-02-03T09:00:00+0900" and updated_time < "2012-02-03T10:00:00+0900"' } # rubocop:disable Metrics/LineLength
|
44
51
|
|
45
52
|
def response_data
|
46
53
|
{ 'records' => [{ 'record_id' => { 'type' => 'RECORD_NUMBER', 'value' => '1' } }] }
|
@@ -55,8 +62,11 @@ describe Kintone::Command::Records do
|
|
55
62
|
:get,
|
56
63
|
'https://example.cybozu.com/k/v1/records.json?app=8&query=&fields%5b0%5d=%E3%83%AC%E3%82%B3%E3%83%BC%E3%83%89%E7%95%AA%E5%8F%B7&fields%5b1%5d=created_time&fields%5b2%5d=dropdown'
|
57
64
|
)
|
58
|
-
.to_return(
|
59
|
-
|
65
|
+
.to_return(
|
66
|
+
body: response_data.to_json,
|
67
|
+
status: 200,
|
68
|
+
headers: { 'Content-type' => 'application/json' }
|
69
|
+
)
|
60
70
|
end
|
61
71
|
|
62
72
|
let(:fields) { %w(レコード番号 created_time dropdown) }
|
@@ -75,8 +85,11 @@ describe Kintone::Command::Records do
|
|
75
85
|
'https://example.cybozu.com/k/v1/records.json'
|
76
86
|
)
|
77
87
|
.with(query: { app: 8, query: '' })
|
78
|
-
.to_return(
|
79
|
-
|
88
|
+
.to_return(
|
89
|
+
body: response_data.to_json,
|
90
|
+
status: 200,
|
91
|
+
headers: { 'Content-type' => 'application/json' }
|
92
|
+
)
|
80
93
|
end
|
81
94
|
|
82
95
|
let(:query) { nil }
|
@@ -93,6 +106,46 @@ describe Kintone::Command::Records do
|
|
93
106
|
|
94
107
|
it { expect { subject }.to raise_error(NoMethodError) }
|
95
108
|
end
|
109
|
+
|
110
|
+
context 'totalCountにtrueを指定した時' do
|
111
|
+
before(:each) do
|
112
|
+
stub_request(
|
113
|
+
:get,
|
114
|
+
'https://example.cybozu.com/k/v1/records.json'
|
115
|
+
)
|
116
|
+
.with(query: { app: 8, query: '', totalCount: true })
|
117
|
+
.to_return(
|
118
|
+
body: response_data.to_json,
|
119
|
+
status: 200,
|
120
|
+
headers: { 'Content-type' => 'application/json' }
|
121
|
+
)
|
122
|
+
end
|
123
|
+
|
124
|
+
subject { target.get(app, query, fields, total_count: total_count) }
|
125
|
+
|
126
|
+
def response_data
|
127
|
+
{ 'records' => [{ 'record_id' => { 'type' => 'RECORD_NUMBER', 'value' => '1' } }] }
|
128
|
+
end
|
129
|
+
|
130
|
+
let(:total_count) { true }
|
131
|
+
it { expect(subject).to eq response_data }
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'fail to request' do
|
135
|
+
before(:each) do
|
136
|
+
stub_request(
|
137
|
+
:get,
|
138
|
+
'https://example.cybozu.com/k/v1/records.json?app=8&query='
|
139
|
+
)
|
140
|
+
.to_return(
|
141
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
142
|
+
status: 500,
|
143
|
+
headers: { 'Content-Type' => 'application/json' }
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
148
|
+
end
|
96
149
|
end
|
97
150
|
|
98
151
|
describe '#register' do
|
@@ -102,8 +155,11 @@ describe Kintone::Command::Records do
|
|
102
155
|
'https://example.cybozu.com/k/v1/records.json'
|
103
156
|
)
|
104
157
|
.with(body: request_body.to_json)
|
105
|
-
.to_return(
|
106
|
-
|
158
|
+
.to_return(
|
159
|
+
body: response_body.to_json,
|
160
|
+
status: 200,
|
161
|
+
headers: { 'Content-type' => 'application/json' }
|
162
|
+
)
|
107
163
|
end
|
108
164
|
|
109
165
|
subject { target.register(app, records) }
|
@@ -141,6 +197,30 @@ describe Kintone::Command::Records do
|
|
141
197
|
|
142
198
|
it { expect(subject).to eq response_body }
|
143
199
|
end
|
200
|
+
|
201
|
+
context 'fail to request' do
|
202
|
+
before(:each) do
|
203
|
+
stub_request(
|
204
|
+
:post,
|
205
|
+
'https://example.cybozu.com/k/v1/records.json'
|
206
|
+
)
|
207
|
+
.with(body: request_body.to_json)
|
208
|
+
.to_return(
|
209
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
210
|
+
status: 500,
|
211
|
+
headers: { 'Content-Type' => 'application/json' }
|
212
|
+
)
|
213
|
+
end
|
214
|
+
|
215
|
+
let(:records) do
|
216
|
+
[
|
217
|
+
{ 'rich_editor' => { 'value' => 'testtest' } },
|
218
|
+
{ 'user_select' => { 'value' => [{ 'code' => 'suzuki' }] } }
|
219
|
+
]
|
220
|
+
end
|
221
|
+
|
222
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
223
|
+
end
|
144
224
|
end
|
145
225
|
|
146
226
|
describe '#update' do
|
@@ -150,8 +230,11 @@ describe Kintone::Command::Records do
|
|
150
230
|
'https://example.cybozu.com/k/v1/records.json'
|
151
231
|
)
|
152
232
|
.with(body: request_body.to_json)
|
153
|
-
.to_return(
|
154
|
-
|
233
|
+
.to_return(
|
234
|
+
body: response_body.to_json,
|
235
|
+
status: 200,
|
236
|
+
headers: { 'Content-type' => 'application/json' }
|
237
|
+
)
|
155
238
|
end
|
156
239
|
|
157
240
|
subject { target.update(app, records) }
|
@@ -244,6 +327,39 @@ describe Kintone::Command::Records do
|
|
244
327
|
it { expect(subject).to eq response_body }
|
245
328
|
end
|
246
329
|
end
|
330
|
+
|
331
|
+
context 'fail to request' do
|
332
|
+
before(:each) do
|
333
|
+
stub_request(
|
334
|
+
:put,
|
335
|
+
'https://example.cybozu.com/k/v1/records.json'
|
336
|
+
)
|
337
|
+
.with(body: request_body.to_json)
|
338
|
+
.to_return(
|
339
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
340
|
+
status: 500,
|
341
|
+
headers: { 'Content-Type' => 'application/json' }
|
342
|
+
)
|
343
|
+
end
|
344
|
+
|
345
|
+
let(:records) do
|
346
|
+
[
|
347
|
+
{ 'id' => 1, 'record' => { 'string_1' => { 'value' => 'abcdef' } } },
|
348
|
+
{ 'id' => 2, 'record' => { 'string_multi' => { 'value' => 'opqrstu' } } }
|
349
|
+
]
|
350
|
+
end
|
351
|
+
let(:request_body) do
|
352
|
+
{
|
353
|
+
'app' => 4,
|
354
|
+
'records' => [
|
355
|
+
{ 'id' => 1, 'record' => { 'string_1' => { 'value' => 'abcdef' } } },
|
356
|
+
{ 'id' => 2, 'record' => { 'string_multi' => { 'value' => 'opqrstu' } } }
|
357
|
+
]
|
358
|
+
}
|
359
|
+
end
|
360
|
+
|
361
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
362
|
+
end
|
247
363
|
end
|
248
364
|
|
249
365
|
describe '#delete' do
|
@@ -253,8 +369,11 @@ describe Kintone::Command::Records do
|
|
253
369
|
'https://example.cybozu.com/k/v1/records.json'
|
254
370
|
)
|
255
371
|
.with(body: request_body.to_json)
|
256
|
-
.to_return(
|
257
|
-
|
372
|
+
.to_return(
|
373
|
+
body: '{}',
|
374
|
+
status: 200,
|
375
|
+
headers: { 'Content-type' => 'application/json' }
|
376
|
+
)
|
258
377
|
end
|
259
378
|
|
260
379
|
context 'without revisions' do
|
@@ -277,5 +396,28 @@ describe Kintone::Command::Records do
|
|
277
396
|
|
278
397
|
it { expect(subject).to eq({}) }
|
279
398
|
end
|
399
|
+
|
400
|
+
context 'fail to request' do
|
401
|
+
before(:each) do
|
402
|
+
stub_request(
|
403
|
+
:delete,
|
404
|
+
'https://example.cybozu.com/k/v1/records.json'
|
405
|
+
)
|
406
|
+
.with(body: request_body.to_json)
|
407
|
+
.to_return(
|
408
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
409
|
+
status: 500,
|
410
|
+
headers: { 'Content-Type' => 'application/json' }
|
411
|
+
)
|
412
|
+
end
|
413
|
+
|
414
|
+
subject { target.delete(app, ids) }
|
415
|
+
|
416
|
+
let(:app) { 1 }
|
417
|
+
let(:ids) { [100, 80] }
|
418
|
+
let(:request_body) { { app: app, ids: ids } }
|
419
|
+
|
420
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
421
|
+
end
|
280
422
|
end
|
281
423
|
end
|
@@ -7,23 +7,41 @@ describe Kintone::Command::SpaceBody do
|
|
7
7
|
let(:api) { Kintone::Api.new('example.cybozu.com', 'Administrator', 'cybozu') }
|
8
8
|
|
9
9
|
describe '#update' do
|
10
|
+
before(:each) do
|
11
|
+
stub_request(
|
12
|
+
:put,
|
13
|
+
'https://example.cybozu.com/k/v1/space/body.json'
|
14
|
+
)
|
15
|
+
.with(body: { id: 1, body: '<b>総務課</b>専用のスペースです。' }.to_json)
|
16
|
+
.to_return(
|
17
|
+
body: '{}',
|
18
|
+
status: 200,
|
19
|
+
headers: { 'Content-type' => 'application/json' }
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
10
23
|
subject { target.update(id, body) }
|
11
24
|
|
12
|
-
|
25
|
+
let(:id) { 1 }
|
26
|
+
let(:body) { '<b>総務課</b>専用のスペースです。' }
|
27
|
+
|
28
|
+
it { expect(subject).to eq({}) }
|
29
|
+
|
30
|
+
context 'fail to request' do
|
13
31
|
before(:each) do
|
14
32
|
stub_request(
|
15
33
|
:put,
|
16
34
|
'https://example.cybozu.com/k/v1/space/body.json'
|
17
35
|
)
|
18
36
|
.with(body: { id: 1, body: '<b>総務課</b>専用のスペースです。' }.to_json)
|
19
|
-
.to_return(
|
20
|
-
|
37
|
+
.to_return(
|
38
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
39
|
+
status: 500,
|
40
|
+
headers: { 'Content-Type' => 'application/json' }
|
41
|
+
)
|
21
42
|
end
|
22
43
|
|
23
|
-
|
24
|
-
let(:body) { '<b>総務課</b>専用のスペースです。' }
|
25
|
-
|
26
|
-
it { expect(subject).to eq({}) }
|
44
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
27
45
|
end
|
28
46
|
end
|
29
47
|
end
|
@@ -15,8 +15,11 @@ describe Kintone::Command::SpaceGuests do
|
|
15
15
|
'https://example.cybozu.com/k/guest/1/v1/space/guests.json'
|
16
16
|
)
|
17
17
|
.with(body: { id: id, guests: guests }.to_json)
|
18
|
-
.to_return(
|
19
|
-
|
18
|
+
.to_return(
|
19
|
+
body: '{}',
|
20
|
+
status: 200,
|
21
|
+
headers: { 'Content-type' => 'application/json' }
|
22
|
+
)
|
20
23
|
end
|
21
24
|
|
22
25
|
subject { target.update(id, guests) }
|
@@ -31,5 +34,22 @@ describe Kintone::Command::SpaceGuests do
|
|
31
34
|
end
|
32
35
|
|
33
36
|
it { is_expected.to be_truthy }
|
37
|
+
|
38
|
+
context 'fail to request' do
|
39
|
+
before(:each) do
|
40
|
+
stub_request(
|
41
|
+
:put,
|
42
|
+
'https://example.cybozu.com/k/guest/1/v1/space/guests.json'
|
43
|
+
)
|
44
|
+
.with(body: { id: id, guests: guests }.to_json)
|
45
|
+
.to_return(
|
46
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
47
|
+
status: 500,
|
48
|
+
headers: { 'Content-Type' => 'application/json' }
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
53
|
+
end
|
34
54
|
end
|
35
55
|
end
|
@@ -13,21 +13,18 @@ describe Kintone::Command::SpaceMembers do
|
|
13
13
|
'https://example.cybozu.com/k/v1/space/members.json'
|
14
14
|
)
|
15
15
|
.with(query: { id: id })
|
16
|
-
.to_return(
|
17
|
-
|
16
|
+
.to_return(
|
17
|
+
body: response_data.to_json,
|
18
|
+
status: 200,
|
19
|
+
headers: { 'Content-type' => 'application/json' }
|
20
|
+
)
|
18
21
|
end
|
19
22
|
|
20
23
|
subject { target.get(id) }
|
21
24
|
|
22
25
|
let(:id) { 1 }
|
23
|
-
|
24
|
-
|
25
|
-
{
|
26
|
-
'members' => members
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def members
|
26
|
+
let(:response_data) { { 'members' => members } }
|
27
|
+
let(:members) do
|
31
28
|
[
|
32
29
|
{
|
33
30
|
'entity' => { 'type' => 'USER', 'code' => 'user1' },
|
@@ -38,6 +35,23 @@ describe Kintone::Command::SpaceMembers do
|
|
38
35
|
end
|
39
36
|
|
40
37
|
it { expect(subject).to match members }
|
38
|
+
|
39
|
+
context 'fail to request' do
|
40
|
+
before(:each) do
|
41
|
+
stub_request(
|
42
|
+
:get,
|
43
|
+
'https://example.cybozu.com/k/v1/space/members.json'
|
44
|
+
)
|
45
|
+
.with(query: { id: id })
|
46
|
+
.to_return(
|
47
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
48
|
+
status: 500,
|
49
|
+
headers: { 'Content-Type' => 'application/json' }
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
54
|
+
end
|
41
55
|
end
|
42
56
|
|
43
57
|
describe '#update' do
|
@@ -47,8 +61,11 @@ describe Kintone::Command::SpaceMembers do
|
|
47
61
|
'https://example.cybozu.com/k/v1/space/members.json'
|
48
62
|
)
|
49
63
|
.with(body: request_data.to_json)
|
50
|
-
.to_return(
|
51
|
-
|
64
|
+
.to_return(
|
65
|
+
body: '{}',
|
66
|
+
status: 200,
|
67
|
+
headers: { 'Content-type' => 'application/json' }
|
68
|
+
)
|
52
69
|
end
|
53
70
|
|
54
71
|
subject { target.update(id, members) }
|
@@ -64,7 +81,7 @@ describe Kintone::Command::SpaceMembers do
|
|
64
81
|
]
|
65
82
|
end
|
66
83
|
|
67
|
-
|
84
|
+
let(:request_data) do
|
68
85
|
{
|
69
86
|
'id' => 1,
|
70
87
|
'members' => [
|
@@ -78,5 +95,22 @@ describe Kintone::Command::SpaceMembers do
|
|
78
95
|
end
|
79
96
|
|
80
97
|
it { expect(subject).to be_truthy }
|
98
|
+
|
99
|
+
context 'fail to request' do
|
100
|
+
before(:each) do
|
101
|
+
stub_request(
|
102
|
+
:put,
|
103
|
+
'https://example.cybozu.com/k/v1/space/members.json'
|
104
|
+
)
|
105
|
+
.with(body: request_data.to_json)
|
106
|
+
.to_return(
|
107
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
108
|
+
status: 500,
|
109
|
+
headers: { 'Content-Type' => 'application/json' }
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
113
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
114
|
+
end
|
81
115
|
end
|
82
116
|
end
|
@@ -7,49 +7,79 @@ describe Kintone::Command::Space do
|
|
7
7
|
let(:api) { Kintone::Api.new('example.cybozu.com', 'Administrator', 'cybozu') }
|
8
8
|
|
9
9
|
describe '#get' do
|
10
|
+
before(:each) do
|
11
|
+
stub_request(
|
12
|
+
:get,
|
13
|
+
'https://example.cybozu.com/k/v1/space.json'
|
14
|
+
)
|
15
|
+
.with(query: { id: 1 })
|
16
|
+
.to_return(
|
17
|
+
body: result.to_json,
|
18
|
+
status: 200,
|
19
|
+
headers: { 'Content-type' => 'application/json' }
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
10
23
|
subject { target.get(id) }
|
11
24
|
|
12
|
-
|
25
|
+
let(:id) { 1 }
|
26
|
+
let(:result) { { 'id' => '1', 'name' => 'sample space' } }
|
27
|
+
|
28
|
+
it { expect(subject).to eq(result) }
|
29
|
+
|
30
|
+
context 'fail to request' do
|
13
31
|
before(:each) do
|
14
32
|
stub_request(
|
15
33
|
:get,
|
16
34
|
'https://example.cybozu.com/k/v1/space.json'
|
17
35
|
)
|
18
36
|
.with(query: { id: 1 })
|
19
|
-
.to_return(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def result
|
26
|
-
{
|
27
|
-
'id' => '1',
|
28
|
-
'name' => 'sample space'
|
29
|
-
}
|
37
|
+
.to_return(
|
38
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
39
|
+
status: 500,
|
40
|
+
headers: { 'Content-Type' => 'application/json' }
|
41
|
+
)
|
30
42
|
end
|
31
43
|
|
32
|
-
it { expect
|
44
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
33
45
|
end
|
34
46
|
end
|
35
47
|
|
36
48
|
describe '#delete' do
|
49
|
+
before(:each) do
|
50
|
+
stub_request(
|
51
|
+
:delete,
|
52
|
+
'https://example.cybozu.com/k/v1/space.json'
|
53
|
+
)
|
54
|
+
.with(body: { id: 1 }.to_json)
|
55
|
+
.to_return(
|
56
|
+
body: '{}',
|
57
|
+
status: 200,
|
58
|
+
headers: { 'Content-type' => 'application/json' }
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
37
62
|
subject { target.delete(id) }
|
38
63
|
|
39
|
-
|
64
|
+
let(:id) { 1 }
|
65
|
+
|
66
|
+
it { expect(subject).to be_truthy }
|
67
|
+
|
68
|
+
context 'fail to request' do
|
40
69
|
before(:each) do
|
41
70
|
stub_request(
|
42
71
|
:delete,
|
43
72
|
'https://example.cybozu.com/k/v1/space.json'
|
44
73
|
)
|
45
74
|
.with(body: { id: 1 }.to_json)
|
46
|
-
.to_return(
|
47
|
-
|
75
|
+
.to_return(
|
76
|
+
body: '{"message":"不正なJSON文字列です。","id":"1505999166-897850006","code":"CB_IJ01"}',
|
77
|
+
status: 500,
|
78
|
+
headers: { 'Content-Type' => 'application/json' }
|
79
|
+
)
|
48
80
|
end
|
49
81
|
|
50
|
-
|
51
|
-
|
52
|
-
it { expect(subject).to be_truthy }
|
82
|
+
it { expect { subject }.to raise_error Kintone::KintoneError }
|
53
83
|
end
|
54
84
|
end
|
55
85
|
end
|