Commit 506ec32a authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'replace-set-with-let-it-be-in-ee-spec-features' into 'master'

Replace set to let_it_be in ee/spec/features

See merge request gitlab-org/gitlab!22782
parents 6b338ad7 83e84558
...@@ -108,9 +108,9 @@ describe 'Admin::AuditLogs', :js do ...@@ -108,9 +108,9 @@ describe 'Admin::AuditLogs', :js do
end end
describe 'filter by date', js: false do describe 'filter by date', js: false do
set(:audit_event_1) { create(:user_audit_event, created_at: 5.days.ago) } let_it_be(:audit_event_1) { create(:user_audit_event, created_at: 5.days.ago) }
set(:audit_event_2) { create(:user_audit_event, created_at: 3.days.ago) } let_it_be(:audit_event_2) { create(:user_audit_event, created_at: 3.days.ago) }
set(:audit_event_3) { create(:user_audit_event, created_at: 1.day.ago) } let_it_be(:audit_event_3) { create(:user_audit_event, created_at: 1.day.ago) }
before do before do
visit admin_audit_logs_path visit admin_audit_logs_path
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require "spec_helper" require "spec_helper"
describe "Admin interacts with push rules" do describe "Admin interacts with push rules" do
set(:user) { create(:admin) } let_it_be(:user) { create(:admin) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require "spec_helper" require "spec_helper"
describe "Admin uploads license" do describe "Admin uploads license" do
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
before do before do
stub_feature_flags(licenses_app: false) stub_feature_flags(licenses_app: false)
...@@ -11,7 +11,7 @@ describe "Admin uploads license" do ...@@ -11,7 +11,7 @@ describe "Admin uploads license" do
end end
context "when license key is provided in the query string" do context "when license key is provided in the query string" do
set(:license) { build(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) } let_it_be(:license) { build(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) }
before do before do
License.destroy_all # rubocop: disable DestroyAll License.destroy_all # rubocop: disable DestroyAll
...@@ -51,8 +51,8 @@ describe "Admin uploads license" do ...@@ -51,8 +51,8 @@ describe "Admin uploads license" do
end end
context "when license is valid" do context "when license is valid" do
set(:license) { build(:gitlab_license) } let_it_be(:license) { build(:gitlab_license) }
set(:path) { Rails.root.join("tmp/valid_license.gitlab-license") } let_it_be(:path) { Rails.root.join("tmp/valid_license.gitlab-license") }
it "uploads license" do it "uploads license" do
attach_and_upload(path) attach_and_upload(path)
...@@ -63,8 +63,8 @@ describe "Admin uploads license" do ...@@ -63,8 +63,8 @@ describe "Admin uploads license" do
end end
context "when license is invalid" do context "when license is invalid" do
set(:license) { build(:gitlab_license, expires_at: Date.yesterday) } let_it_be(:license) { build(:gitlab_license, expires_at: Date.yesterday) }
set(:path) { Rails.root.join("tmp/invalid_license.gitlab-license") } let_it_be(:path) { Rails.root.join("tmp/invalid_license.gitlab-license") }
it "doesn't upload license" do it "doesn't upload license" do
attach_and_upload(path) attach_and_upload(path)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require "spec_helper" require "spec_helper"
describe "Admin views license" do describe "Admin views license" do
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
before do before do
stub_feature_flags(licenses_app: false) stub_feature_flags(licenses_app: false)
...@@ -25,7 +25,7 @@ describe "Admin views license" do ...@@ -25,7 +25,7 @@ describe "Admin views license" do
end end
context "when license is trial" do context "when license is trial" do
set(:license) { create(:license, trial: true) } let_it_be(:license) { create(:license, trial: true) }
before do before do
visit(admin_license_path) visit(admin_license_path)
...@@ -38,7 +38,7 @@ describe "Admin views license" do ...@@ -38,7 +38,7 @@ describe "Admin views license" do
end end
context "when license is expired" do context "when license is expired" do
set(:license) { create(:license, trial: true, expired: true) } let_it_be(:license) { create(:license, trial: true, expired: true) }
it "does not mention blocking of changes" do it "does not mention blocking of changes" do
page.within(".gitlab-ee-license-banner") do page.within(".gitlab-ee-license-banner") do
...@@ -50,7 +50,7 @@ describe "Admin views license" do ...@@ -50,7 +50,7 @@ describe "Admin views license" do
end end
context "when license is regular" do context "when license is regular" do
set(:license) { create(:license) } let_it_be(:license) { create(:license) }
before do before do
visit(admin_license_path) visit(admin_license_path)
...@@ -65,19 +65,19 @@ describe "Admin views license" do ...@@ -65,19 +65,19 @@ describe "Admin views license" do
end end
context "when license expired" do context "when license expired" do
set(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday).export).save(validate: false) } let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday).export).save(validate: false) }
it { expect(page).to have_content("Your license expired") } it { expect(page).to have_content("Your license expired") }
context "when license blocks changes" do context "when license blocks changes" do
set(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday, block_changes_at: Date.today).export).save(validate: false) } let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday, block_changes_at: Date.today).export).save(validate: false) }
it { expect(page).to have_content "Pushing code and creation of issues and merge requests has been disabled." } it { expect(page).to have_content "Pushing code and creation of issues and merge requests has been disabled." }
end end
end end
context "when viewing license history" do context "when viewing license history" do
set(:license) { create(:license) } let_it_be(:license) { create(:license) }
it "shows licensee" do it "shows licensee" do
license_history = page.find("#license_history") license_history = page.find("#license_history")
...@@ -90,7 +90,7 @@ describe "Admin views license" do ...@@ -90,7 +90,7 @@ describe "Admin views license" do
end end
context "with limited users" do context "with limited users" do
set(:license) { create(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) } let_it_be(:license) { create(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) }
before do before do
visit(admin_license_path) visit(admin_license_path)
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe 'Multiple Issue Boards', :js do describe 'Multiple Issue Boards', :js do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:group) { create(:group, :public) } let_it_be(:group) { create(:group, :public) }
set(:planning) { create(:group_label, group: group, name: 'Planning') } let_it_be(:planning) { create(:group_label, group: group, name: 'Planning') }
set(:board) { create(:board, group: group) } let_it_be(:board) { create(:board, group: group) }
let(:parent) { group } let(:parent) { group }
let(:boards_path) { group_boards_path(group) } let(:boards_path) { group_boards_path(group) }
......
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
require 'spec_helper' require 'spec_helper'
describe 'Dashboard todos' do describe 'Dashboard todos' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:author) { create(:user) } let_it_be(:author) { create(:user) }
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
let(:page_path) { dashboard_todos_path } let(:page_path) { dashboard_todos_path }
it_behaves_like 'dashboard gold trial callout' it_behaves_like 'dashboard gold trial callout'
context 'User has a todo regarding a design' do context 'User has a todo regarding a design' do
set(:target) { create(:design, issue: issue) } let_it_be(:target) { create(:design, issue: issue) }
set(:note) { create(:note, project: project, note: "I am note, hear me roar") } let_it_be(:note) { create(:note, project: project, note: "I am note, hear me roar") }
set(:todo) do let_it_be(:todo) do
create(:todo, :mentioned, create(:todo, :mentioned,
user: user, user: user,
project: project, project: project,
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'GEO Nodes', :geo do describe 'GEO Nodes', :geo do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:geo_primary) { create(:geo_node, :primary) } let_it_be(:geo_primary) { create(:geo_node, :primary) }
set(:geo_secondary) { create(:geo_node) } let_it_be(:geo_secondary) { create(:geo_node) }
context 'Geo Secondary Node' do context 'Geo Secondary Node' do
let(:project) { create(:project) } let(:project) { create(:project) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require "spec_helper" require "spec_helper"
describe "User adds hook" do describe "User adds hook" do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:url) { "http://example.org" } let_it_be(:url) { "http://example.org" }
before do before do
group.add_owner(user) group.add_owner(user)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe 'User edits hooks' do describe 'User edits hooks' do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:hook) { create(:group_hook, group: group) } let_it_be(:hook) { create(:group_hook, group: group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:url) { 'http://example.org/new' } let(:url) { 'http://example.org/new' }
before do before do
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require "spec_helper" require "spec_helper"
describe "User views hooks" do describe "User views hooks" do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:hook) { create(:group_hook, group: group) } let_it_be(:hook) { create(:group_hook, group: group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
before do before do
group.add_owner(user) group.add_owner(user)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
describe 'Group Insights' do describe 'Group Insights' do
it_behaves_like 'Insights page' do it_behaves_like 'Insights page' do
set(:entity) { create(:group) } let_it_be(:entity) { create(:group) }
let(:route) { url_for([entity, :insights]) } let(:route) { url_for([entity, :insights]) }
let(:path) { group_insights_path(entity) } let(:path) { group_insights_path(entity) }
end end
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'Group Packages' do describe 'Group Packages' do
include SortingHelper include SortingHelper
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, group: group) } let_it_be(:project) { create(:project, group: group) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -6,8 +6,8 @@ describe 'Two merge requests on a merge train' do ...@@ -6,8 +6,8 @@ describe 'Two merge requests on a merge train' do
include RepoHelpers include RepoHelpers
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
set(:maintainer_1) { create(:user) } let_it_be(:maintainer_1) { create(:user) }
set(:maintainer_2) { create(:user) } let_it_be(:maintainer_2) { create(:user) }
let(:merge_request_1) do let(:merge_request_1) do
create(:merge_request, create(:merge_request,
......
...@@ -5,11 +5,11 @@ require 'spec_helper' ...@@ -5,11 +5,11 @@ require 'spec_helper'
describe 'Profile > Pipeline Quota' do describe 'Profile > Pipeline Quota' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
set(:user) { create(:user) } let_it_be(:user, reload: true) { create(:user) }
set(:namespace) { user.namespace } let_it_be(:namespace, reload: true) { user.namespace }
set(:statistics) { create(:namespace_statistics, namespace: namespace) } let_it_be(:statistics, reload: true) { create(:namespace_statistics, namespace: namespace) }
set(:project) { create(:project, namespace: namespace) } let_it_be(:project, reload: true) { create(:project, namespace: namespace) }
set(:other_project) { create(:project, namespace: namespace, shared_runners_enabled: false) } let_it_be(:other_project) { create(:project, namespace: namespace, shared_runners_enabled: false) }
before do before do
gitlab_sign_in(user) gitlab_sign_in(user)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
describe 'Project Insights' do describe 'Project Insights' do
it_behaves_like 'Insights page' do it_behaves_like 'Insights page' do
set(:entity) { create(:project) } let_it_be(:entity) { create(:project) }
let(:route) { url_for([entity.namespace, entity, :insights]) } let(:route) { url_for([entity.namespace, entity, :insights]) }
let(:path) { project_insights_path(entity) } let(:path) { project_insights_path(entity) }
end end
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'User uploads new design', :js do describe 'User uploads new design', :js do
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:project) { create(:project_empty_repo, :public) } let_it_be(:project) { create(:project_empty_repo, :public) }
set(:user) { project.owner } let_it_be(:user) { project.owner }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'Users views raw design image files' do describe 'Users views raw design image files' do
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
set(:design) { create(:design, :with_file, issue: issue, versions_count: 2) } let_it_be(:design) { create(:design, :with_file, issue: issue, versions_count: 2) }
let(:newest_version) { design.versions.ordered.first } let(:newest_version) { design.versions.ordered.first }
let(:oldest_version) { design.versions.ordered.last } let(:oldest_version) { design.versions.ordered.last }
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'User views issue designs', :js do describe 'User views issue designs', :js do
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:project) { create(:project_empty_repo, :public) } let_it_be(:project) { create(:project_empty_repo, :public) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
set(:design) { create(:design, :with_file, issue: issue) } let_it_be(:design) { create(:design, :with_file, issue: issue) }
before do before do
enable_design_management enable_design_management
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'User views issue designs', :js do describe 'User views issue designs', :js do
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:project) { create(:project_empty_repo, :public) } let_it_be(:project) { create(:project_empty_repo, :public) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
set(:design) { create(:design, :with_file, issue: issue) } let_it_be(:design) { create(:design, :with_file, issue: issue) }
before do before do
enable_design_management enable_design_management
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe 'User activates Alerts' do describe 'User activates Alerts' do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:service_name) { 'alerts' } let(:service_name) { 'alerts' }
let(:service_title) { 'Alerts endpoint' } let(:service_title) { 'Alerts endpoint' }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require "spec_helper" require "spec_helper"
describe "User manages members" do describe "User manages members" do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, namespace: group) } let_it_be(:project) { create(:project, namespace: group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'Tracings Content Security Policy' do describe 'Tracings Content Security Policy' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
subject { response_headers['Content-Security-Policy'] } subject { response_headers['Content-Security-Policy'] }
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'Geo read-only message', :geo do describe 'Geo read-only message', :geo do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe '[EE] Internal Group access' do describe '[EE] Internal Group access' do
include AccessMatchers include AccessMatchers
set(:group) { create(:group, :internal) } let_it_be(:group) { create(:group, :internal) }
set(:project) { create(:project, :internal, group: group) } let_it_be(:project) { create(:project, :internal, group: group) }
set(:project_guest) do let_it_be(:project_guest) do
create(:user) do |user| create(:user) do |user|
project.add_guest(user) project.add_guest(user)
end end
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe '[EE] Private Group access' do describe '[EE] Private Group access' do
include AccessMatchers include AccessMatchers
set(:group) { create(:group, :private) } let_it_be(:group) { create(:group, :private) }
set(:project) { create(:project, :private, group: group) } let_it_be(:project) { create(:project, :private, group: group) }
set(:project_guest) do let_it_be(:project_guest) do
create(:user) do |user| create(:user) do |user|
project.add_guest(user) project.add_guest(user)
end end
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe '[EE] Public Group access' do describe '[EE] Public Group access' do
include AccessMatchers include AccessMatchers
set(:group) { create(:group, :public) } let_it_be(:group) { create(:group, :public) }
set(:project) { create(:project, :public, group: group) } let_it_be(:project) { create(:project, :public, group: group) }
set(:project_guest) do let_it_be(:project_guest) do
create(:user) do |user| create(:user) do |user|
project.add_guest(user) project.add_guest(user)
end end
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe '[EE] Internal Project Access' do describe '[EE] Internal Project Access' do
include AccessMatchers include AccessMatchers
set(:project) { create(:project, :internal, :repository) } let_it_be(:project) { create(:project, :internal, :repository) }
describe 'GET /:project_path/insights' do describe 'GET /:project_path/insights' do
before do before do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe '[EE] Private Project Access' do describe '[EE] Private Project Access' do
include AccessMatchers include AccessMatchers
set(:project) { create(:project, :private, :repository) } let_it_be(:project) { create(:project, :private, :repository) }
describe 'GET/:project_path/insights' do describe 'GET/:project_path/insights' do
before do before do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe '[EE] Public Project Access' do describe '[EE] Public Project Access' do
include AccessMatchers include AccessMatchers
set(:project) { create(:project, :public, :repository) } let_it_be(:project) { create(:project, :public, :repository) }
describe 'GET /:project_path/insights' do describe 'GET /:project_path/insights' do
before do before do
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require "spec_helper" require "spec_helper"
describe "Admin unsubscribes from notification" do describe "Admin unsubscribes from notification" do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:urlsafe_email) { Base64.urlsafe_encode64(user.email) } let_it_be(:urlsafe_email) { Base64.urlsafe_encode64(user.email) }
before do before do
sign_in(user) sign_in(user)
......
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