Commit 3863e46b authored by Nick Thomas's avatar Nick Thomas

Fix Project#feature_available? specs

parent 16e88fff
......@@ -22,15 +22,16 @@ describe Project, models: true do
before do
stub_application_setting('check_namespace_plan?' => check_namespace_plan)
allow(Gitlab).to receive(:com?) { true }
expect_any_instance_of(License).to receive(:feature_available?).with(feature) { allowed_on_global_license }
expect(License).to receive(:feature_available?).with(feature) { allowed_on_global_license }
allow(namespace).to receive(:plan) { plan_license }
end
License::FEATURE_CODES.each do |feature_sym, feature_code|
context feature_sym.to_s do
let(:feature) { feature_sym }
let(:feature_code) { feature_code }
context "checking #{feature} availabily both on Global and Namespace license" do
context "checking #{feature_sym} availability both on Global and Namespace license" do
let(:check_namespace_plan) { true }
context 'allowed by Plan License AND Global License' do
......@@ -54,6 +55,7 @@ describe Project, models: true do
end
end
unless License.plan_includes_feature?(License::STARTER_PLAN, feature_sym)
context 'not allowed by Plan License' do
let(:allowed_on_global_license) { true }
let(:plan_license) { Namespace::BRONZE_PLAN }
......@@ -62,6 +64,7 @@ describe Project, models: true do
is_expected.to eq(false)
end
end
end
context 'not allowed by Global License' do
let(:allowed_on_global_license) { false }
......@@ -94,6 +97,7 @@ describe Project, models: true do
end
end
end
end
context 'when feature symbol is not included on Namespace features code' do
let(:feature) { :issues }
......
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