|
6 | 6 | context "destroy_many!" do |
7 | 7 | before(:each) do |
8 | 8 | stub_json_request(:delete, %r{bulk_test_resources/destroy_many}, json(:job_status => {:id => 'abc'})) |
| 9 | + @response = subject.destroy_many!(client, [1,2,3]) |
9 | 10 | end |
10 | 11 |
|
11 | 12 | it 'calls the destroy_many endpoint' do |
12 | | - subject.destroy_many!(client, [1,2,3]) |
13 | 13 | assert_requested(:delete, %r{bulk_test_resources/destroy_many\?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3}) |
14 | 14 | end |
| 15 | + |
| 16 | + it 'returns a JobStatus' do |
| 17 | + expect(@response).to be_instance_of(ZendeskAPI::JobStatus) |
| 18 | + expect(@response.id).to eq('abc') |
| 19 | + end |
15 | 20 | end |
16 | 21 | end |
17 | 22 |
|
|
20 | 25 |
|
21 | 26 | context "create_many!" do |
22 | 27 | let(:attributes) { [{:name => 'A'}, {:name => 'B'}] } |
| 28 | + |
23 | 29 | before(:each) do |
24 | | - stub_json_request(:post, %r{bulk_test_resources/create_many}, json(:job_status => {:id => 'abc'})) |
| 30 | + stub_json_request(:post, %r{bulk_test_resources/create_many}, json(:job_status => {:id => 'def'})) |
| 31 | + @response = subject.create_many!(client, attributes) |
25 | 32 | end |
26 | 33 |
|
27 | 34 | it 'calls the create_many endpoint' do |
28 | | - subject.create_many!(client, attributes) |
29 | 35 | assert_requested(:post, %r{bulk_test_resources/create_many}, |
30 | 36 | :body => json(:bulk_test_resources => attributes) |
31 | 37 | ) |
32 | 38 | end |
| 39 | + |
| 40 | + it 'returns a JobStatus' do |
| 41 | + expect(@response).to be_instance_of(ZendeskAPI::JobStatus) |
| 42 | + expect(@response.id).to eq('def') |
| 43 | + end |
33 | 44 | end |
34 | 45 | end |
0 commit comments