Commit cc95525c authored by Andrejs Cunskis's avatar Andrejs Cunskis

Move feature flag toggle to before-each block

parent 4e20c48e
...@@ -3,16 +3,18 @@ ...@@ -3,16 +3,18 @@
module QA module QA
RSpec.describe 'Manage', :requires_admin do RSpec.describe 'Manage', :requires_admin do
describe 'Bulk group import' do describe 'Bulk group import' do
let!(:admin_api_client) { Runtime::API::Client.as_admin } let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let!(:user) do
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
Resource::User.fabricate_via_api! do |usr| Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true usr.hard_delete_on_api_removal = true
end end
end end
let!(:api_client) { Runtime::API::Client.new(user: user) } let(:api_client) { Runtime::API::Client.new(user: user) }
let!(:personal_access_token) { api_client.personal_access_token } let(:personal_access_token) { api_client.personal_access_token }
let(:sandbox) do let(:sandbox) do
Resource::Sandbox.fabricate_via_api! do |group| Resource::Sandbox.fabricate_via_api! do |group|
...@@ -51,16 +53,10 @@ module QA ...@@ -51,16 +53,10 @@ module QA
end end
end end
def staging? before do
Runtime::Scenario.gitlab_address.include?('staging.gitlab.com')
end
before(:all) do
Runtime::Feature.enable(:bulk_import) unless staging? Runtime::Feature.enable(:bulk_import) unless staging?
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging? Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
end
before do
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
# create groups explicitly before connecting gitlab instance # create groups explicitly before connecting gitlab instance
...@@ -116,9 +112,7 @@ module QA ...@@ -116,9 +112,7 @@ module QA
after do after do
user.remove_via_api! user.remove_via_api!
end ensure
after(:all) do
Runtime::Feature.disable(:bulk_import) unless staging? Runtime::Feature.disable(:bulk_import) unless staging?
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging? Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
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