Commit 8a4b8776 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Replace set with let_it_be in spec/helpers

Removes usage of `set` in specs
parent 308e8f7e
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe AutoDevopsHelper do
set(:project) { create(:project) }
set(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:user) { create(:user) }
describe '.show_auto_devops_callout?' do
let(:allowed) { true }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe BoardsHelper do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
describe '#build_issue_link_base' do
context 'project board' do
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe EnvironmentsHelper do
set(:user) { create(:user) }
set(:project) { create(:project, :repository) }
set(:environment) { create(:environment, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, :repository) }
let_it_be(:environment) { create(:environment, project: project) }
describe '#metrics_data' do
before do
......
......@@ -35,7 +35,7 @@ describe LabelsHelper 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 asking for an issue link' do
......@@ -135,7 +135,7 @@ describe LabelsHelper do
end
describe 'create_label_title' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
context 'with a group as subject' do
it 'returns "Create group label"' do
......@@ -144,7 +144,7 @@ describe LabelsHelper do
end
context 'with a project as subject' do
set(:project) { create(:project, namespace: group) }
let_it_be(:project) { create(:project, namespace: group) }
it 'returns "Create project label"' do
expect(create_label_title(project)).to eq _('Create project label')
......@@ -159,7 +159,7 @@ describe LabelsHelper do
end
describe 'manage_labels_title' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
context 'with a group as subject' do
it 'returns "Manage group labels"' do
......@@ -168,7 +168,7 @@ describe LabelsHelper do
end
context 'with a project as subject' do
set(:project) { create(:project, namespace: group) }
let_it_be(:project) { create(:project, namespace: group) }
it 'returns "Manage project labels"' do
expect(manage_labels_title(project)).to eq _('Manage project labels')
......@@ -183,7 +183,7 @@ describe LabelsHelper do
end
describe 'view_labels_title' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
context 'with a group as subject' do
it 'returns "View group labels"' do
......@@ -192,7 +192,7 @@ describe LabelsHelper do
end
context 'with a project as subject' do
set(:project) { create(:project, namespace: group) }
let_it_be(:project) { create(:project, namespace: group) }
it 'returns "View project labels"' do
expect(view_labels_title(project)).to eq _('View project labels')
......
......@@ -3,15 +3,15 @@
require 'spec_helper'
describe MarkupHelper do
set(:project) { create(:project, :repository) }
set(:user) do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) do
user = create(:user, username: 'gfm')
project.add_maintainer(user)
user
end
set(:issue) { create(:issue, project: project) }
set(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
set(:snippet) { create(:project_snippet, project: project) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let_it_be(:snippet) { create(:project_snippet, project: project) }
let(:commit) { project.commit }
before do
......@@ -45,8 +45,8 @@ describe MarkupHelper do
describe "override default project" do
let(:actual) { issue.to_reference }
set(:second_project) { create(:project, :public) }
set(:second_issue) { create(:issue, project: second_project) }
let_it_be(:second_project) { create(:project, :public) }
let_it_be(:second_issue) { create(:issue, project: second_project) }
it 'links to the issue' do
expected = urls.project_issue_path(second_project, second_issue)
......@@ -57,7 +57,7 @@ describe MarkupHelper do
describe 'uploads' do
let(:text) { "![ImageTest](/uploads/test.png)" }
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
subject { helper.markdown(text) }
......@@ -79,7 +79,7 @@ describe MarkupHelper do
end
describe "with a group in the context" do
set(:project_in_group) { create(:project, group: group) }
let_it_be(:project_in_group) { create(:project, group: group) }
before do
helper.instance_variable_set(:@group, group)
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe Projects::ErrorTrackingHelper do
include Gitlab::Routing.url_helpers
set(:project) { create(:project) }
set(:current_user) { create(:user) }
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:current_user) { create(:user) }
describe '#error_tracking_data' do
let(:can_enable_error_tracking) { true }
......
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