diff options
Diffstat (limited to 'spec/requests/api/task_completion_status_spec.rb')
-rw-r--r-- | spec/requests/api/task_completion_status_spec.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/requests/api/task_completion_status_spec.rb b/spec/requests/api/task_completion_status_spec.rb index 4739e2cbe2b..c23beeb0211 100644 --- a/spec/requests/api/task_completion_status_spec.rb +++ b/spec/requests/api/task_completion_status_spec.rb @@ -50,18 +50,23 @@ describe 'task completion status response' do } ] samples.each do |sample_data| - it "returns a valid task list status #{sample_data}" do - taskable.update!(description: sample_data[:description]) + context "#{sample_data}" do + before do + taskable.update!(description: sample_data[:description]) - get api("#{path}?iids[]=#{taskable.iid}", user) + get api("#{path}?iids[]=#{taskable.iid}", user) + end - expect(response).to have_gitlab_http_status(200) - expect(json_response).to be_an Array - expect(json_response).not_to be_empty + it { expect(response).to have_gitlab_http_status(200) } - task_completion_status = json_response.first['task_completion_status'] - expect(task_completion_status['count']).to be(sample_data[:expected_count]) - expect(task_completion_status['completed_count']).to be(sample_data[:expected_completed_count]) + it "returns the expected results" do + expect(json_response).to be_an Array + expect(json_response).not_to be_empty + + task_completion_status = json_response.first['task_completion_status'] + expect(task_completion_status['count']).to eq(sample_data[:expected_count]) + expect(task_completion_status['completed_count']).to eq(sample_data[:expected_completed_count]) + end end end end |