Commit ceac76ef authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Peter Leitzen

Replace set to let_it_be in spec/features

Get rids of set in spec/features
parent b191b3aa
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe "Admin Health Check", :feature do
include StubENV
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
......
......@@ -3,11 +3,11 @@
require 'spec_helper'
describe 'Multiple Issue Boards', :js do
set(:user) { create(:user) }
set(:project) { create(:project, :public) }
set(:planning) { create(:label, project: project, name: 'Planning') }
set(:board) { create(:board, name: 'board1', project: project) }
set(:board2) { create(:board, name: 'board2', project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:planning) { create(:label, project: project, name: 'Planning') }
let_it_be(:board) { create(:board, name: 'board1', project: project) }
let_it_be(:board2) { create(:board, name: 'board2', project: project) }
let(:parent) { project }
let(:boards_path) { project_boards_path(project) }
......
......@@ -129,10 +129,10 @@ describe 'Issue Boards new issue', :js do
end
context 'group boards' do
set(:group) { create(:group, :public) }
set(:project) { create(:project, namespace: group) }
set(:group_board) { create(:board, group: group) }
set(:list) { create(:list, board: group_board, position: 0) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:group_board) { create(:board, group: group) }
let_it_be(:list) { create(:list, board: group_board, position: 0) }
context 'for unauthorized users' do
before do
......
......@@ -3,17 +3,17 @@
require 'spec_helper'
describe 'Root explore' do
set(:public_project) { create(:project, :public) }
set(:archived_project) { create(:project, :archived) }
set(:internal_project) { create(:project, :internal) }
set(:private_project) { create(:project, :private) }
let_it_be(:public_project) { create(:project, :public) }
let_it_be(:archived_project) { create(:project, :archived) }
let_it_be(:internal_project) { create(:project, :internal) }
let_it_be(:private_project) { create(:project, :private) }
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when logged in' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe 'User explores projects' do
set(:archived_project) { create(:project, :archived) }
set(:internal_project) { create(:project, :internal) }
set(:private_project) { create(:project, :private) }
set(:public_project) { create(:project, :public) }
let_it_be(:archived_project) { create(:project, :archived) }
let_it_be(:internal_project) { create(:project, :internal) }
let_it_be(:private_project) { create(:project, :private) }
let_it_be(:public_project) { create(:project, :public) }
context 'when not signed in' do
context 'when viewing public projects' do
......@@ -19,7 +19,7 @@ describe 'User explores projects' do
end
context 'when signed in' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Groups > Labels > User sees links to issuables' do
set(:group) { create(:group, :public) }
let_it_be(:group) { create(:group, :public) }
before do
create(:group_label, group: group, title: 'bug')
......
......@@ -7,7 +7,7 @@ describe "User views issues" do
let!(:open_issue1) { create(:issue, project: project) }
let!(:open_issue2) { create(:issue, project: project) }
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
shared_examples "opens issue from list" do
it "opens issue" do
......
......@@ -5,8 +5,7 @@ require 'spec_helper'
describe 'Merge request > User posts notes', :js do
include NoteInteractionHelpers
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:merge_request) do
create(:merge_request, source_project: project, target_project: project)
......
......@@ -10,10 +10,10 @@ describe 'User sorts merge requests' do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
set(:user) { create(:user) }
set(:group) { create(:group) }
set(:group_member) { create(:group_member, :maintainer, user: user, group: group) }
set(:project) { create(:project, :public, group: group) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:group_member) { create(:group_member, :maintainer, user: user, group: group) }
let_it_be(:project) { create(:project, :public, group: group) }
before do
sign_in(user)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'User views open merge requests' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
shared_examples_for 'shows merge requests' do
it 'shows merge requests' do
......@@ -12,7 +12,7 @@ describe 'User views open merge requests' do
end
context 'when project is public' do
set(:project) { create(:project, :public, :repository) }
let_it_be(:project) { create(:project, :public, :repository) }
context 'when not signed in' do
context "when the target branch is the project's default branch" do
......@@ -114,7 +114,7 @@ describe 'User views open merge requests' do
context 'when project is internal' do
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
set(:project) { create(:project, :internal, :repository) }
let_it_be(:project) { create(:project, :internal, :repository) }
context 'when signed in' do
before do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe "User creates milestone", :js do
set(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
before do
project.add_developer(user)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe "User edits milestone", :js do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:milestone) { create(:milestone, project: project, start_date: Date.today, due_date: 5.days.from_now) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:milestone) { create(:milestone, project: project, start_date: Date.today, due_date: 5.days.from_now) }
before do
project.add_developer(user)
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe 'User promotes milestone' do
set(:group) { create(:group) }
set(:user) { create(:user) }
set(:project) { create(:project, namespace: group) }
set(:milestone) { create(:milestone, project: project) }
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:milestone) { create(:milestone, project: project) }
context 'when user can admin group milestones' do
before do
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe "User views milestone" do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:milestone) { create(:milestone, project: project) }
set(:labels) { create_list(:label, 2, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:milestone) { create(:milestone, project: project) }
let_it_be(:labels) { create_list(:label, 2, project: project) }
before do
project.add_developer(user)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe "User views milestones" do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:milestone) { create(:milestone, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:milestone) { create(:milestone, project: project) }
before do
project.add_developer(user)
......@@ -22,8 +22,8 @@ describe "User views milestones" do
end
context "with issues" do
set(:issue) { create(:issue, project: project, milestone: milestone) }
set(:closed_issue) { create(:closed_issue, project: project, milestone: milestone) }
let_it_be(:issue) { create(:issue, project: project, milestone: milestone) }
let_it_be(:closed_issue) { create(:closed_issue, project: project, milestone: milestone) }
it "opens milestone" do
click_link(milestone.title)
......@@ -38,7 +38,7 @@ describe "User views milestones" do
end
context "with associated releases" do
set(:first_release) { create(:release, project: project, name: "The first release", milestones: [milestone], released_at: Time.zone.parse('2019-10-07')) }
let_it_be(:first_release) { create(:release, project: project, name: "The first release", milestones: [milestone], released_at: Time.zone.parse('2019-10-07')) }
context "with a single associated release" do
it "shows the associated release" do
......@@ -48,10 +48,10 @@ describe "User views milestones" do
end
context "with lots of associated releases" do
set(:second_release) { create(:release, project: project, name: "The second release", milestones: [milestone], released_at: first_release.released_at + 1.day) }
set(:third_release) { create(:release, project: project, name: "The third release", milestones: [milestone], released_at: second_release.released_at + 1.day) }
set(:fourth_release) { create(:release, project: project, name: "The fourth release", milestones: [milestone], released_at: third_release.released_at + 1.day) }
set(:fifth_release) { create(:release, project: project, name: "The fifth release", milestones: [milestone], released_at: fourth_release.released_at + 1.day) }
let_it_be(:second_release) { create(:release, project: project, name: "The second release", milestones: [milestone], released_at: first_release.released_at + 1.day) }
let_it_be(:third_release) { create(:release, project: project, name: "The third release", milestones: [milestone], released_at: second_release.released_at + 1.day) }
let_it_be(:fourth_release) { create(:release, project: project, name: "The fourth release", milestones: [milestone], released_at: third_release.released_at + 1.day) }
let_it_be(:fifth_release) { create(:release, project: project, name: "The fifth release", milestones: [milestone], released_at: fourth_release.released_at + 1.day) }
it "shows the associated releases and the truncation text" do
expect(page).to have_content("Releases #{fifth_release.name}#{fourth_release.name}#{third_release.name} • 2 more releases")
......@@ -66,9 +66,9 @@ describe "User views milestones" do
end
describe "User views milestones with no MR" do
set(:user) { create(:user) }
set(:project) { create(:project, :merge_requests_disabled) }
set(:milestone) { create(:milestone, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :merge_requests_disabled) }
let_it_be(:milestone) { create(:milestone, project: project) }
before do
project.add_developer(user)
......
......@@ -3,9 +3,9 @@
require "spec_helper"
describe "User downloads artifacts" do
set(:project) { create(:project, :repository, :public) }
set(:pipeline) { create(:ci_empty_pipeline, status: :success, sha: project.commit.id, project: project) }
set(:job) { create(:ci_build, :artifacts, :success, pipeline: pipeline) }
let_it_be(:project) { create(:project, :repository, :public) }
let_it_be(:pipeline) { create(:ci_empty_pipeline, status: :success, sha: project.commit.id, project: project) }
let_it_be(:job) { create(:ci_build, :artifacts, :success, pipeline: pipeline) }
shared_examples "downloading" do
it "downloads the zip" do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Pipeline Badge' do
set(:project) { create(:project, :repository, :public) }
let_it_be(:project) { create(:project, :repository, :public) }
let(:ref) { project.default_branch }
context 'when the project has a pipeline' do
......
......@@ -3,7 +3,7 @@
require "spec_helper"
describe "User deletes branch", :js do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do
......
......@@ -3,8 +3,8 @@
require "spec_helper"
describe "User views branches" do
set(:project) { create(:project, :repository) }
set(:user) { project.owner }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
before do
sign_in(user)
......@@ -23,7 +23,7 @@ describe "User views branches" do
end
context "protected branches" do
set(:protected_branch) { create(:protected_branch, project: project) }
let_it_be(:protected_branch) { create(:protected_branch, project: project) }
before do
visit(project_protected_branches_path(project))
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe 'Project > Commit > View user status' do
include RepoHelpers
set(:project) { create(:project, :repository) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let(:commit_author) { create(:user, email: sample_commit.author_email) }
before do
......
......@@ -3,8 +3,8 @@
require "spec_helper"
describe "User creates labels" do
set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:user) { create(:user) }
shared_examples_for "label creation" do
it "creates new label" do
......@@ -66,7 +66,7 @@ describe "User creates labels" do
end
context "in another project" do
set(:another_project) { create(:project_empty_repo, :public) }
let_it_be(:another_project) { create(:project_empty_repo, :public) }
before do
create(:label, project: project, title: "bug") # Create label for `project` (not `another_project`) project.
......
......@@ -3,9 +3,9 @@
require "spec_helper"
describe "User edits labels" do
set(:project) { create(:project_empty_repo, :public) }
set(:label) { create(:label, project: project) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:label) { create(:label, project: project) }
let_it_be(:user) { create(:user) }
before do
project.add_maintainer(user)
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe 'User promotes label' do
set(:group) { create(:group) }
set(:user) { create(:user) }
set(:project) { create(:project, namespace: group) }
set(:label) { create(:label, project: project) }
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:label) { create(:label, project: project) }
context 'when user can admin group labels' do
before do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Projects > Labels > User sees links to issuables' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
label # creates the label
......@@ -50,7 +50,7 @@ describe 'Projects > Labels > User sees links to issuables' do
end
context 'with a group label' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
let(:label) { create(:group_label, group: group, title: 'bug') }
context 'when merge requests and issues are enabled for the project' do
......
......@@ -3,9 +3,8 @@
require "spec_helper"
describe "User views labels" do
set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:user) { create(:user) }
let(:label_titles) { %w[bug enhancement feature] }
let!(:prioritized_label) { create(:label, project: project, title: 'prioritized-label-name', priority: 1) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Projects settings' do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
let(:panel) { find('.general-settings', match: :first) }
let(:button) { panel.find('.btn.js-settings-toggle') }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Projects > Show > User sees Git instructions' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
shared_examples_for 'redirects to the sign in page' do
it 'redirects to the sign in page' do
......@@ -49,7 +49,7 @@ describe 'Projects > Show > User sees Git instructions' do
context 'when project is public' do
context 'when project has no repo' do
set(:project) { create(:project, :public) }
let_it_be(:project) { create(:project, :public) }
before do
sign_in(project.owner)
......@@ -60,7 +60,7 @@ describe 'Projects > Show > User sees Git instructions' do
end
context 'when project is empty' do
set(:project) { create(:project_empty_repo, :public) }
let_it_be(:project) { create(:project_empty_repo, :public) }
context 'when not signed in' do
before do
......@@ -98,7 +98,7 @@ describe 'Projects > Show > User sees Git instructions' do
end
context 'when project is not empty' do
set(:project) { create(:project, :public, :repository) }
let_it_be(:project) { create(:project, :public, :repository) }
before do
visit(project_path(project))
......@@ -141,7 +141,7 @@ describe 'Projects > Show > User sees Git instructions' do
end
context 'when project is internal' do
set(:project) { create(:project, :internal, :repository) }
let_it_be(:project) { create(:project, :internal, :repository) }
context 'when not signed in' do
before do
......@@ -163,7 +163,7 @@ describe 'Projects > Show > User sees Git instructions' do
end
context 'when project is private' do
set(:project) { create(:project, :private) }
let_it_be(:project) { create(:project, :private) }
before do
visit(project_path(project))
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Projects > Show > User sees last commit CI status' do
set(:project) { create(:project, :repository, :public) }
let_it_be(:project) { create(:project, :repository, :public) }
it 'shows the project README', :js do
project.enable_ci
......
......@@ -3,9 +3,8 @@
require 'spec_helper'
describe 'Projects > Show > User sees README' do
set(:user) { create(:user) }
set(:project) { create(:project, :repository, :public) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, :public) }
it 'shows the project README', :js do
visit project_path(project)
......
......@@ -3,8 +3,7 @@
require 'spec_helper'
describe 'User sees user popover', :js do
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:merge_request) do
create(:merge_request, source_project: project, target_project: project)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'Projects > Wiki > User previews markdown changes', :js do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :wiki_repo, namespace: user.namespace) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) }
let(:wiki_content) do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe 'read-only message' do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe "Internal Project Access" do
include AccessMatchers
set(:project) { create(:project, :internal, :repository) }
let_it_be(:project, reload: true) { create(:project, :internal, :repository) }
describe "Project should be internal" do
describe '#internal?' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe "Private Project Access" do
include AccessMatchers
set(:project) { create(:project, :private, :repository, public_builds: false) }
let_it_be(:project, reload: true) { create(:project, :private, :repository, public_builds: false) }
describe "Project should be private" do
describe '#private?' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe "Public Project Access" do
include AccessMatchers
set(:project) { create(:project, :public, :repository) }
let_it_be(:project, reload: true) { create(:project, :public, :repository) }
describe "Project should be public" do
describe '#public?' do
......
......@@ -10,10 +10,10 @@ describe "User sorts things" do
include Spec::Support::Helpers::Features::SortingHelpers
include DashboardHelper
set(:project) { create(:project_empty_repo, :public) }
set(:current_user) { create(:user) } # Using `current_user` instead of just `user` because of the hardoced call in `assigned_mrs_dashboard_path` which is used below.
set(:issue) { create(:issue, project: project, author: current_user) }
set(:merge_request) { create(:merge_request, target_project: project, source_project: project, author: current_user) }
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:current_user) { create(:user) } # Using `current_user` instead of just `user` because of the hardoced call in `assigned_mrs_dashboard_path` which is used below.
let_it_be(:issue) { create(:issue, project: project, author: current_user) }
let_it_be(:merge_request) { create(:merge_request, target_project: project, source_project: project, author: current_user) }
before do
project.add_developer(current_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