summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-06-22 19:15:09 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2016-07-01 14:52:04 +0200
commit3942621329b20307c1676d60324c8f47ea1e1b37 (patch)
tree45ec7ce2810878a7951946754cad10fad28642ab /spec/requests
parentfd9cd5ae8cd2d2f5488635b264eb86d89d768d66 (diff)
downloadgitlab-ce-3942621329b20307c1676d60324c8f47ea1e1b37.tar.gz
Expose target, filter by state as string
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/todos_spec.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb
index 8d54b4fd3d8..f93f37e3591 100644
--- a/spec/requests/api/todos_spec.rb
+++ b/spec/requests/api/todos_spec.rb
@@ -9,7 +9,7 @@ describe API::Todos, api: true do
let(:author_2) { create(:user) }
let(:john_doe) { create(:user, username: 'john_doe') }
let(:merge_request) { create(:merge_request, source_project: project_1) }
- let!(:pending_1) { create(:todo, project: project_1, author: author_1, user: john_doe) }
+ let!(:pending_1) { create(:todo, :mentioned, project: project_1, author: author_1, user: john_doe) }
let!(:pending_2) { create(:todo, project: project_2, author: author_2, user: john_doe) }
let!(:pending_3) { create(:todo, project: project_1, author: author_2, user: john_doe, target: merge_request) }
let!(:done) { create(:todo, :done, project: project_1, author: author_1, user: john_doe) }
@@ -38,9 +38,8 @@ describe API::Todos, api: true do
expect(json_response[0]['id']).to eq(pending_3.id)
expect(json_response[0]['project']).to be_a Hash
expect(json_response[0]['author']).to be_a Hash
- expect(json_response[0]['target_id']).to be_present
expect(json_response[0]['target_type']).to be_present
- expect(json_response[0]['target_reference']).to be_present
+ expect(json_response[0]['target']).to be_a Hash
expect(json_response[0]['target_url']).to be_present
expect(json_response[0]['body']).to be_present
expect(json_response[0]['state']).to eq('pending')
@@ -87,6 +86,16 @@ describe API::Todos, api: true do
expect(json_response.length).to eq(1)
end
end
+
+ context 'and using the action filter' do
+ it 'filters based on action param' do
+ get api('/todos', john_doe), { action: 'mentioned' }
+
+ expect(response.status).to eq(200)
+ expect(json_response).to be_an Array
+ expect(json_response.length).to eq(1)
+ end
+ end
end
end