summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-02 21:19:13 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 12:58:58 -0300
commit296bcbd6640ddeb06093c2505ed749be07362975 (patch)
tree7864e4b47b6080f1128ac16dea9dc4d66d16bc19 /spec/controllers
parent52b6a7e966670fd7320dc821d11311f50b3725e7 (diff)
downloadgitlab-ce-296bcbd6640ddeb06093c2505ed749be07362975.tar.gz
Add endpoint to list issues for a specific board list
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/board_issues_controller_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/controllers/projects/board_issues_controller_spec.rb b/spec/controllers/projects/board_issues_controller_spec.rb
new file mode 100644
index 00000000000..64c98443caa
--- /dev/null
+++ b/spec/controllers/projects/board_issues_controller_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe Projects::BoardIssuesController do
+ let(:project) { create(:project_with_board) }
+ let(:user) { create(:user) }
+
+ before do
+ project.team << [user, :master]
+ sign_in(user)
+ end
+
+ describe 'GET #index' do
+ context 'with valid list id' do
+ it 'returns issues that have the list label applied' do
+ label1 = create(:label, project: project, name: 'Planning')
+ label2 = create(:label, project: project, name: 'Development')
+
+ create(:labeled_issue, project: project, labels: [label1])
+ create(:labeled_issue, project: project, labels: [label2])
+ create(:labeled_issue, project: project, labels: [label2])
+
+ create(:list, board: project.board, label: label1, position: 1)
+ development = create(:list, board: project.board, label: label2, position: 2)
+
+ get :index, namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ list_id: development.to_param
+
+ parsed_response = JSON.parse(response.body)
+
+ expect(response).to match_response_schema('issue', array: true)
+ expect(parsed_response.length).to eq 2
+ end
+ end
+
+ context 'with invalid list id' do
+ it 'returns a not found 404 response' do
+ get :index, namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: 999
+
+ expect(response).to have_http_status(404)
+ end
+ end
+ end
+end