summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Derichs <pderichs@gitlab.com>2019-06-06 13:14:18 +0200
committerPatrick Derichs <pderichs@gitlab.com>2019-06-06 13:14:18 +0200
commite1dea2fef907f9a1a03e9cef1acbab8d2911bf88 (patch)
treeafdfc61cd914a70fb0ec616b81d28d92b0fcdb8e
parente1b9fab8ddab48f0ff680bb5ddc52f6f0a8ae11a (diff)
downloadgitlab-ce-51636-task-list-api-pderichs.tar.gz
Refactor spec so it separates status code check and content check51636-task-list-api-pderichs
-rw-r--r--spec/requests/api/task_completion_status_spec.rb23
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