Commit ef3eb79a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Reject creating boards when the feature is not available

parent e5da0e50
...@@ -3,6 +3,7 @@ module EE ...@@ -3,6 +3,7 @@ module EE
module BoardsController module BoardsController
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
before_action :check_multiple_issue_boards_available!, only: [:create]
before_action :authorize_admin_board!, only: [:create, :update, :destroy] before_action :authorize_admin_board!, only: [:create, :update, :destroy]
before_action :find_board, only: [:update, :destroy] before_action :find_board, only: [:update, :destroy]
end end
......
...@@ -30,6 +30,11 @@ describe Projects::BoardsController do # rubocop:disable RSpec/FilePath ...@@ -30,6 +30,11 @@ describe Projects::BoardsController do # rubocop:disable RSpec/FilePath
end end
describe 'POST create' do describe 'POST create' do
context 'with the multiple issue boards available' do
before do
stub_licensed_features(multiple_issue_boards: true)
end
context 'with valid params' do context 'with valid params' do
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
create_board name: 'Backend' create_board name: 'Backend'
...@@ -65,6 +70,15 @@ describe Projects::BoardsController do # rubocop:disable RSpec/FilePath ...@@ -65,6 +70,15 @@ describe Projects::BoardsController do # rubocop:disable RSpec/FilePath
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
end end
end
it 'renders a 404 when multiple issue boards are not available' do
stub_licensed_features(multiple_issue_boards: false)
create_board name: 'Backend'
expect(response).to have_http_status(404)
end
def create_board(name:) def create_board(name:)
post :create, namespace_id: project.namespace.to_param, post :create, namespace_id: project.namespace.to_param,
......
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