Commit 88540db2 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rails-save-bang-11' into 'master'

Fix SaveBang cop for spec in spec/views/* and ee/spec/views/*

See merge request gitlab-org/gitlab!38981
parents 30f1b949 5092eff2
......@@ -877,7 +877,6 @@ Rails/SaveBang:
- 'ee/spec/support/shared_examples/requests/api/project_approval_rules_api_shared_examples.rb'
- 'ee/spec/support/shared_examples/services/build_execute_shared_examples.rb'
- 'ee/spec/support/shared_examples/services/issue_epic_shared_examples.rb'
- 'ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb'
- 'ee/spec/workers/adjourned_project_deletion_worker_spec.rb'
- 'ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb'
- 'ee/spec/workers/create_github_webhook_worker_spec.rb'
......@@ -1342,7 +1341,3 @@ Rails/SaveBang:
- 'spec/tasks/gitlab/web_hook_rake_spec.rb'
- 'spec/uploaders/file_uploader_spec.rb'
- 'spec/uploaders/object_storage_spec.rb'
- 'spec/views/notify/changed_milestone_email.html.haml_spec.rb'
- 'spec/views/projects/imports/new.html.haml_spec.rb'
- 'spec/views/projects/merge_requests/show.html.haml_spec.rb'
- 'spec/views/shared/_label_row.html.haml_spec.rb'
---
title: Refactor spec/views/* and ee/spec/views/* to fix Rails/SaveBang Cop
merge_request: 38981
author: Rajendra Kadam
type: fixed
......@@ -30,7 +30,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
before do
stub_licensed_features(feature_flags: true)
project.project_feature.update(builds_access_level: feature)
project.project_feature.update!(builds_access_level: feature)
project.team.add_developer(user)
sign_in(user)
......
......@@ -22,7 +22,7 @@ RSpec.describe 'notify/changed_milestone_email.html.haml' do
context 'milestone with start and due dates' do
before do
milestone.update(start_date: '2018-01-01', due_date: '2018-12-31')
milestone.update!(start_date: '2018-01-01', due_date: '2018-12-31')
end
it 'renders with date range' do
......
......@@ -9,7 +9,7 @@ RSpec.describe "projects/imports/new.html.haml" do
let(:project) { create(:project_empty_repo, :import_failed, import_type: :gitlab_project, import_source: '/var/opt/gitlab/gitlab-rails/shared/tmp/project_exports/uploads/t.tar.gz', import_url: nil) }
before do
project.import_state.update(last_error: '<a href="http://googl.com">Foo</a>')
project.import_state.update!(last_error: '<a href="http://googl.com">Foo</a>')
sign_in(user)
project.add_maintainer(user)
end
......
......@@ -12,7 +12,7 @@ RSpec.describe 'projects/merge_requests/show.html.haml' do
describe 'merge request assignee sidebar' do
context 'when assignee is allowed to merge' do
it 'does not show a warning icon' do
closed_merge_request.update(assignee_id: user.id)
closed_merge_request.update!(assignee_id: user.id)
project.add_maintainer(user)
assign(:issuable_sidebar, serialize_issuable_sidebar(user, project, closed_merge_request))
......@@ -42,20 +42,4 @@ RSpec.describe 'projects/merge_requests/show.html.haml' do
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
end
context 'when the merge request is open' do
it 'closes the merge request if the source project does not exist' do
closed_merge_request.update(state: 'open')
forked_project.destroy
# Reload merge request so MergeRequest#source_project turns to `nil`
closed_merge_request.reload
preload_view_requirements
render
expect(closed_merge_request.reload.state).to eq('closed')
expect(rendered).to have_css('a', visible: false, text: 'Reopen')
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
end
end
......@@ -9,7 +9,7 @@ RSpec.describe 'shared/_label_row.html.haml' do
label_types.each do |label_type, label_factory|
let!(:label) do
label_record = create(label_factory)
label_record = create(label_factory) # rubocop: disable Rails/SaveBang
label_record.present(issuable_subject: label_record.subject)
end
......
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