Use let instead of instance var

parent 83386eeb
......@@ -25,14 +25,14 @@ module QA
end
describe 'Group' do
before(:all) do
@group = Resource::Group.fabricate_via_api! do |resource|
let(:group) do
Resource::Group.fabricate_via_api! do |resource|
resource.path = "test-group-#{SecureRandom.hex(8)}"
end
end
before do
@event_count = get_audit_event_count(@group)
@event_count = get_audit_event_count(group)
end
let(:project) do
......@@ -42,7 +42,6 @@ module QA
end
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:group) { @group }
context 'Add group' do
let(:group_name) { 'new group' }
......@@ -53,22 +52,15 @@ module QA
Resource::Group.fabricate_via_browser_ui! do |group|
group.name = group_name
end.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
end
it_behaves_like 'audit event', ['Added group'] do
let(:group) do
Resource::Group.fabricate_via_api! do |group|
group.name = group_name
end
end
end
it_behaves_like 'audit event', ['Added group']
end
context 'Change repository size limit', :requires_admin do
before do
sign_in(as_admin: true)
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform do |settings|
settings.set_repository_size_limit(100)
......@@ -81,8 +73,8 @@ module QA
context 'Update group name' do
before do
sign_in
@group.visit!
updated_group_name = "#{@group.path}-updated"
group.visit!
updated_group_name = "#{group.path}-updated"
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform do |settings|
settings.set_group_name(updated_group_name)
......@@ -96,7 +88,7 @@ module QA
context 'Add user, change access level, remove user' do
before do
sign_in
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_members_item)
Page::Group::Members.perform do |members_page|
members_page.add_member(user.username)
......@@ -115,15 +107,15 @@ module QA
Page::Project::Menu.perform(&:click_members)
Page::Project::Members.perform do |members|
members.invite_group(@group.path)
members.invite_group(group.path)
end
Page::Project::Menu.perform(&:click_members)
Page::Project::Members.perform do |members|
members.remove_group(@group.path)
members.remove_group(group.path)
end
@group.visit!
group.visit!
end
it_behaves_like 'audit event', ['Added project access', 'Removed project access']
......
......@@ -13,8 +13,8 @@ module QA
end
describe 'Group' do
before(:all) do
@group = Resource::Group.fabricate_via_api! do |resource|
let(:group) do
Resource::Group.fabricate_via_api! do |resource|
resource.path = "test-group-#{SecureRandom.hex(8)}"
end
end
......@@ -22,7 +22,7 @@ module QA
context 'Disable and Enable LFS' do
before do
sign_in
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform(&:set_lfs_disabled)
......@@ -36,7 +36,7 @@ module QA
context 'Enable and disable membership lock' do
before do
sign_in
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform(&:set_membership_lock_enabled)
......@@ -50,7 +50,7 @@ module QA
context 'Enable and disable allow user request access' do
before do
sign_in
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform(&:toggle_request_access)
......@@ -106,7 +106,7 @@ module QA
context 'Change project creation level' do
before do
sign_in
@group.visit!
group.visit!
Page::Group::Menu.perform(&:click_group_general_settings_item)
Page::Group::Settings::General.perform do |settings|
settings.set_project_creation_level("Maintainers")
......
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