Commit e9f4ce15 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'rails-save-bang-features-issues' into 'master'

Fix Rails/SaveBang offenses in spec/features/issues

See merge request gitlab-org/gitlab!57900
parents 78b27d62 7119000b
......@@ -181,16 +181,6 @@ Rails/SaveBang:
- 'spec/features/dashboard/issuables_counter_spec.rb'
- 'spec/features/dashboard/project_member_activity_index_spec.rb'
- 'spec/features/dashboard/projects_spec.rb'
- 'spec/features/issues/bulk_assignment_labels_spec.rb'
- 'spec/features/issues/gfm_autocomplete_spec.rb'
- 'spec/features/issues/issue_sidebar_spec.rb'
- 'spec/features/issues/note_polling_spec.rb'
- 'spec/features/issues/user_creates_branch_and_merge_request_spec.rb'
- 'spec/features/issues/user_creates_confidential_merge_request_spec.rb'
- 'spec/features/issues/user_edits_issue_spec.rb'
- 'spec/features/issues/user_filters_issues_spec.rb'
- 'spec/features/issues/user_sees_live_update_spec.rb'
- 'spec/features/issues/user_sorts_issues_spec.rb'
- 'spec/frontend/fixtures/issues.rb'
- 'spec/frontend/fixtures/merge_requests.rb'
- 'spec/graphql/mutations/merge_requests/set_locked_spec.rb'
......
---
title: Fix Rails/SaveBang rubocop offenses in spec/features/issues
merge_request: 57900
author: Abdul Wadood @abdulwd
type: fixed
......@@ -295,8 +295,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do
before do
issue1.milestone = milestone
issue2.milestone = milestone
issue1.save
issue2.save
issue1.save!
issue2.save!
issue1.labels << bug
issue2.labels << feature
......
......@@ -171,7 +171,7 @@ RSpec.describe 'Issue Sidebar' do
context 'editing issue labels', :js do
before do
issue.update(labels: [label])
issue.update!(labels: [label])
page.within('.block.labels') do
click_on 'Edit'
end
......
......@@ -103,7 +103,7 @@ RSpec.describe 'Issue notes polling', :js do
end
def update_note(note, new_text)
note.update(note: new_text)
note.update!(note: new_text)
wait_for_requests
end
......
......@@ -150,7 +150,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do
context 'when merge requests are disabled' do
before do
project.project_feature.update(merge_requests_access_level: 0)
project.project_feature.update!(merge_requests_access_level: 0)
visit project_issue_path(project, issue)
end
......
......@@ -38,7 +38,7 @@ RSpec.describe 'User creates confidential merge request on issue page', :js do
let(:forked_project) { fork_project(project, user, repository: true) }
before do
forked_project.update(visibility: Gitlab::VisibilityLevel::PRIVATE)
forked_project.update!(visibility: Gitlab::VisibilityLevel::PRIVATE)
visit_confidential_issue
end
......
......@@ -78,7 +78,7 @@ RSpec.describe "Issues > User edits issue", :js do
end
it 'warns about version conflict' do
issue.update(title: "New title")
issue.update!(title: "New title")
fill_in 'issue_title', with: 'bug 345'
fill_in 'issue_description', with: 'bug description'
......@@ -307,7 +307,7 @@ RSpec.describe "Issues > User edits issue", :js do
before do
project.add_guest(guest)
issue.milestone = milestone
issue.save
issue.save!
end
it 'shows milestone text' do
......
......@@ -18,7 +18,7 @@ RSpec.describe 'User filters issues', :js do
@issue = Issue.find_by(title: 'foobar')
@issue.milestone = create(:milestone, project: project)
@issue.assignees = []
@issue.save
@issue.save!
end
let(:issue) { @issue }
......
......@@ -18,7 +18,7 @@ RSpec.describe 'Issues > User sees live update', :js do
expect(page).to have_text("new title")
issue.update(title: "updated title")
issue.update!(title: "updated title")
wait_for_requests
expect(page).to have_text("updated title")
......
......@@ -77,7 +77,7 @@ RSpec.describe "User sorts issues" do
it 'sorts by most recently updated', :js do
issue3.updated_at = Time.now + 100
issue3.save
issue3.save!
visit project_issues_path(project, sort: sort_value_recently_updated)
expect(first_issue).to include('baz')
......@@ -85,8 +85,8 @@ RSpec.describe "User sorts issues" do
describe 'sorting by due date', :js do
before do
issue1.update(due_date: 1.day.from_now)
issue2.update(due_date: 6.days.from_now)
issue1.update!(due_date: 1.day.from_now)
issue2.update!(due_date: 6.days.from_now)
end
it 'sorts by due date' do
......@@ -96,7 +96,7 @@ RSpec.describe "User sorts issues" do
end
it 'sorts by due date by excluding nil due dates' do
issue2.update(due_date: nil)
issue2.update!(due_date: nil)
visit project_issues_path(project, sort: sort_value_due_date)
......@@ -111,7 +111,7 @@ RSpec.describe "User sorts issues" do
end
it 'sorts by least recently due date by excluding nil due dates' do
issue2.update(due_date: nil)
issue2.update!(due_date: nil)
visit project_issues_path(project, label_names: [label.name], sort: sort_value_due_date_later)
......@@ -122,8 +122,8 @@ RSpec.describe "User sorts issues" do
describe 'filtering by due date', :js do
before do
issue1.update(due_date: 1.day.from_now)
issue2.update(due_date: 6.days.from_now)
issue1.update!(due_date: 1.day.from_now)
issue2.update!(due_date: 6.days.from_now)
end
it 'filters by none' do
......@@ -147,9 +147,9 @@ RSpec.describe "User sorts issues" do
end
it 'filters by due this week' do
issue1.update(due_date: Date.today.beginning_of_week + 2.days)
issue2.update(due_date: Date.today.end_of_week)
issue3.update(due_date: Date.today - 8.days)
issue1.update!(due_date: Date.today.beginning_of_week + 2.days)
issue2.update!(due_date: Date.today.end_of_week)
issue3.update!(due_date: Date.today - 8.days)
visit project_issues_path(project, due_date: Issue::DueThisWeek.name)
......@@ -161,9 +161,9 @@ RSpec.describe "User sorts issues" do
end
it 'filters by due this month' do
issue1.update(due_date: Date.today.beginning_of_month + 2.days)
issue2.update(due_date: Date.today.end_of_month)
issue3.update(due_date: Date.today - 50.days)
issue1.update!(due_date: Date.today.beginning_of_month + 2.days)
issue2.update!(due_date: Date.today.end_of_month)
issue3.update!(due_date: Date.today - 50.days)
visit project_issues_path(project, due_date: Issue::DueThisMonth.name)
......@@ -175,9 +175,9 @@ RSpec.describe "User sorts issues" do
end
it 'filters by overdue' do
issue1.update(due_date: Date.today + 2.days)
issue2.update(due_date: Date.today + 20.days)
issue3.update(due_date: Date.yesterday)
issue1.update!(due_date: Date.today + 2.days)
issue2.update!(due_date: Date.today + 20.days)
issue3.update!(due_date: Date.yesterday)
visit project_issues_path(project, due_date: Issue::Overdue.name)
......@@ -189,9 +189,9 @@ RSpec.describe "User sorts issues" do
end
it 'filters by due next month and previous two weeks' do
issue1.update(due_date: Date.today - 4.weeks)
issue2.update(due_date: (Date.today + 2.months).beginning_of_month)
issue3.update(due_date: Date.yesterday)
issue1.update!(due_date: Date.today - 4.weeks)
issue2.update!(due_date: (Date.today + 2.months).beginning_of_month)
issue3.update!(due_date: Date.yesterday)
visit project_issues_path(project, due_date: Issue::DueNextMonthAndPreviousTwoWeeks.name)
......@@ -206,9 +206,9 @@ RSpec.describe "User sorts issues" do
describe 'sorting by milestone', :js do
before do
issue1.milestone = newer_due_milestone
issue1.save
issue1.save!
issue2.milestone = later_due_milestone
issue2.save
issue2.save!
end
it 'sorts by milestone' do
......@@ -224,9 +224,9 @@ RSpec.describe "User sorts issues" do
before do
issue1.assignees << user2
issue1.save
issue1.save!
issue2.assignees << user2
issue2.save
issue2.save!
end
it 'sorts with a filter applied' do
......
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