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

Use the `stub_licensed_features` helper in specs

Reuse an existing helper to enable and disable licensed features
parent cb78be1a
...@@ -8,8 +8,8 @@ describe 'Protected Environments' do ...@@ -8,8 +8,8 @@ describe 'Protected Environments' do
let(:environments) { %w(production development staging test) } let(:environments) { %w(production development staging test) }
before do before do
allow(License).to receive(:feature_available?).and_call_original stub_licensed_features(protected_environments: true)
allow(License).to receive(:feature_available?).with(:protected_environments).and_return(true)
environments.each do |environment_name| environments.each do |environment_name|
create(:environment, name: environment_name, project: project) create(:environment, name: environment_name, project: project)
end end
......
...@@ -29,8 +29,7 @@ describe Environment do ...@@ -29,8 +29,7 @@ describe Environment do
subject { environment.protected? } subject { environment.protected? }
before do before do
allow(project).to receive(:feature_available?) stub_licensed_features(protected_environments: feature_available)
.with(:protected_environments).and_return(feature_available)
end end
context 'when Protected Environments feature is not available on the project' do context 'when Protected Environments feature is not available on the project' do
...@@ -63,8 +62,7 @@ describe Environment do ...@@ -63,8 +62,7 @@ describe Environment do
subject { environment.protected_deployable_by_user?(user) } subject { environment.protected_deployable_by_user?(user) }
before do before do
allow(project).to receive(:feature_available?) stub_licensed_features(protected_environments: true)
.with(:protected_environments).and_return(feature_available)
end end
context 'when Protected Environments feature is not available on the project' do context 'when Protected Environments feature is not available on the project' 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