Commit fa86a635 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'ss/fix-license-for-limit' into 'master'

Fix license for wrk in prog limit in boards

See merge request gitlab-org/gitlab!23214
parents ecfa56a4 097e43aa
......@@ -11,7 +11,7 @@ module EE
private
def push_wip_limits
push_frontend_feature_flag(:wip_limits, parent) if License.feature_available?(:wip_limits)
push_frontend_feature_flag(:wip_limits, parent) if parent.feature_available?(:wip_limits)
end
end
end
......@@ -47,6 +47,11 @@ describe Groups::BoardsController do
let(:parent) { group }
end
it_behaves_like 'pushes wip limits to frontend' do
let(:params) { { group_id: group } }
let(:parent) { group }
end
def list_boards(format: :html)
get :index, params: { group_id: group }, format: format
end
......
......@@ -25,6 +25,11 @@ describe Projects::BoardsController do
end
it_behaves_like 'redirects to last visited board'
it_behaves_like 'pushes wip limits to frontend' do
let(:parent) { project }
let(:params) { { namespace_id: parent.namespace, project_id: parent } }
end
end
describe 'GET recent' do
......
# frozen_string_literal: true
require 'spec_helper'
shared_examples 'pushes wip limits to frontend' do
let(:plan_license) { :free_plan }
let(:group) { create(:group, plan: plan_license) }
let(:global_license) { create(:license) }
before do
allow(License).to receive(:current).and_return(global_license)
end
context 'self-hosted with correct license' do
let(:plan_license) { :bronze_plan }
it 'is enabled for all groups if the license is correct' do
expect(subject).to receive(:push_frontend_feature_flag).at_least(:once)
get :index, params: params
end
end
context 'on .com' do
before do
enable_namespace_license_check!
end
context 'for group with correct plan' do
before do
namespace = parent.is_a?(Group) ? parent : parent.namespace
namespace.plan = create(:bronze_plan)
end
it 'is enabled' do
expect(subject).to receive(:push_frontend_feature_flag).at_least(:once)
get :index, params: params
end
end
context 'for group with incorrect or no plan' do
it 'is not enabled' do
expect(subject).not_to receive(:push_frontend_feature_flag).with(:wip_limits, anything)
get :index, params: params
end
end
end
end
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