Use let instead of instance var

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