Skip to content

Commit f07c962

Browse files
committedJan 10, 2016
Fix test case, now can close #78
httprb/http#293
1 parent 5ddf470 commit f07c962

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
 

‎spec/lib/wechat/api_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@
241241

242242
describe '#material_add' do
243243
specify 'will post material/add_material with access_token, type and media payload at file based api endpoint' do
244-
file = 'file'
245-
expect(subject.client).to receive(:post)
246-
.with('material/add_material', { upload: { media: file } },
244+
file = 'README.md'
245+
expect(subject.client).to receive(:post_file)
246+
.with('material/add_material', file,
247247
params: { type: 'image', access_token: 'access_token' }).and_return(true)
248248
expect(subject.material_add('image', file)).to be true
249249
end

‎spec/lib/wechat/client_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
specify 'will add accept=>:json for request' do
3838
block = lambda do |url, headers|
3939
expect(url).to eq('http://host/token')
40-
expect(headers).to eq(params: { access_token: '1234' }, accept: :json)
40+
expect(headers).to eq(params: { access_token: '1234' }, 'Accept' => 'application/json')
4141
response_json
4242
end
4343

‎spec/lib/wechat/corp_api_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@
426426

427427
describe '#material_add' do
428428
specify 'will post material/add_material with access_token, type and media payload at file based api endpoint' do
429-
file = 'file'
430-
expect(subject.client).to receive(:post)
431-
.with('material/add_material', { upload: { media: file } },
429+
file = 'README.md'
430+
expect(subject.client).to receive(:post_file)
431+
.with('material/add_material', file,
432432
params: { type: 'image', access_token: 'access_token', agentid: '1' }).and_return(true)
433433
expect(subject.material_add('image', file)).to be true
434434
end

0 commit comments

Comments
 (0)