Move endpoint to list issues under lists resources

parent 1fa7274c
......@@ -23,7 +23,7 @@ class Projects::BoardIssuesController < Projects::ApplicationController
private
def filter_params
params.permit(:list_id)
params.merge(id: params[:list_id])
end
def move_params
......
......@@ -857,8 +857,11 @@ Rails.application.routes.draw do
end
resource :board, only: [:show] do
resources :issues, only: [:index, :update], controller: :board_issues
resources :lists, only: [:create, :update, :destroy], controller: :board_lists
resources :issues, only: [:update], controller: :board_issues
resources :lists, only: [:create, :update, :destroy], controller: :board_lists do
resources :issues, only: [:index], controller: :board_issues
end
end
resources :todos, only: [:create]
......
......@@ -22,9 +22,7 @@ describe Projects::BoardIssuesController do
create(:labeled_issue, project: project, labels: [development])
create(:labeled_issue, project: project, labels: [development])
get :index, namespace_id: project.namespace.to_param,
project_id: project.to_param,
list_id: list2.to_param
list_issues list_id: list2
parsed_response = JSON.parse(response.body)
......@@ -35,13 +33,17 @@ describe Projects::BoardIssuesController do
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
list_issues list_id: 999
expect(response).to have_http_status(404)
end
end
def list_issues(list_id:)
get :index, namespace_id: project.namespace.to_param,
project_id: project.to_param,
list_id: list_id.to_param
end
end
describe 'PATCH #update' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment