Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 6.1 - Replace deprecated update_attributes with update in specs (moderation/discussion) and rake task (migrate_disccusion_focuses) #399

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tasks/migrate_discussion_focuses.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace :data do
Discussion.where('focus_type' => nil).joins(:comments).where('comments.focus_type' => 'Subject').find_each do |discussion|
first_comment = discussion.comments.order(created_at: :asc).first
if first_comment.focus
discussion.update_attributes focus_id: first_comment.focus_id, focus_type: first_comment.focus_type
discussion.update focus_id: first_comment.focus_id, focus_type: first_comment.focus_type
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/discussion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def move_discussion

it 'should clear sticky' do
expect{
discussion.update_attributes sticky: false
discussion.update sticky: false
}.to change{
discussion.sticky_position
}.to nil
Expand Down Expand Up @@ -207,7 +207,7 @@ def create_discussion(position: nil)

before(:each) do
users.each{ |user| user.subscribe_to board, :started_discussions }
unsubscribed_user.preference_for(:started_discussions).update_attributes enabled: false
unsubscribed_user.preference_for(:started_discussions).update enabled: false
end

it 'should create notifications for subscribed users' do
Expand Down
4 changes: 2 additions & 2 deletions spec/models/moderation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
describe '#notify_subscribers' do
before(:each) do
admins.each do |admin|
admin.preference_for(:moderation_reports).update_attributes enabled: false
admin.preference_for(:moderation_reports).update enabled: false
end
end
include_context 'moderation subscriptions'
Expand Down Expand Up @@ -156,7 +156,7 @@
context 'when the preference is disabled' do
before(:each) do
admins.each do |admin|
admin.preference_for(:moderation_reports).update_attributes enabled: false
admin.preference_for(:moderation_reports).update enabled: false
end
end

Expand Down
Loading