diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 9078d48fa5f..fdbb781b1ba 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -779,7 +779,7 @@ class AccountsController < ApplicationController render :json => @account.errors, :status => :unauthorized else success = @account.errors.empty? - success &&= @account.update_attributes(account_settings.merge(quota_settings)) rescue false + success &&= @account.update(account_settings.merge(quota_settings)) rescue false if success # Successfully completed @@ -984,7 +984,7 @@ class AccountsController < ApplicationController # Set default Dashboard view set_default_dashboard_view(params.dig(:account, :settings)&.delete(:default_dashboard_view)) - if @account.update_attributes(strong_account_params) + if @account.update(strong_account_params) update_user_dashboards format.html { redirect_to account_settings_url(@account) } format.json { render :json => @account } diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb index 225e6792acb..bbb3627e8a1 100644 --- a/app/controllers/alerts_controller.rb +++ b/app/controllers/alerts_controller.rb @@ -36,7 +36,7 @@ class AlertsController < ApplicationController if authorized_action(@context, @current_user, :manage_interaction_alerts) convert_recipients @alert = @context.alerts.find(params[:id]) - if @alert.update_attributes(alert_params) + if @alert.update(alert_params) headers['Location'] = named_context_url(@context, :context_alert_url, @alert.id) render :json => @alert.as_json(:include => :criteria) else diff --git a/app/controllers/appointment_groups_controller.rb b/app/controllers/appointment_groups_controller.rb index 9b0ef6f3e4e..f75836676e0 100644 --- a/app/controllers/appointment_groups_controller.rb +++ b/app/controllers/appointment_groups_controller.rb @@ -473,7 +473,7 @@ class AppointmentGroupsController < ApplicationController @group.contexts = contexts if contexts if authorized_action(@group, @current_user, :update) publish = params[:appointment_group].delete(:publish) == "1" - if (publish && params[:appointment_group].blank?) || @group.update_attributes(appointment_group_params) + if (publish && params[:appointment_group].blank?) || @group.update(appointment_group_params) @group.publish! if publish render :json => appointment_group_json(@group, @current_user, session) else diff --git a/app/controllers/assessment_questions_controller.rb b/app/controllers/assessment_questions_controller.rb index cea6156303b..05dd31a5955 100644 --- a/app/controllers/assessment_questions_controller.rb +++ b/app/controllers/assessment_questions_controller.rb @@ -41,7 +41,7 @@ class AssessmentQuestionsController < ApplicationController params[:assessment_question] ||= {} params[:assessment_question][:form_question_data] ||= params[:question] @question.edited_independent_of_quiz_question - if @question.with_versioning { @question.update_attributes(assessment_question_params) } + if @question.with_versioning { @question.update(assessment_question_params) } render json: question_json(@question, @current_user, session, [:assessment_question]) else render :json => @question.errors, :status => :bad_request diff --git a/app/controllers/bookmarks/bookmarks_controller.rb b/app/controllers/bookmarks/bookmarks_controller.rb index acf87153e1b..d3b4019e585 100644 --- a/app/controllers/bookmarks/bookmarks_controller.rb +++ b/app/controllers/bookmarks/bookmarks_controller.rb @@ -131,7 +131,7 @@ class Bookmarks::BookmarksController < ApplicationController # # @returns Folder def update - if @bookmark.update_attributes(valid_params) && set_position + if @bookmark.update(valid_params) && set_position show else render_errors diff --git a/app/controllers/calendar_events_api_controller.rb b/app/controllers/calendar_events_api_controller.rb index be3e9837c98..1c39ab7dc45 100644 --- a/app/controllers/calendar_events_api_controller.rb +++ b/app/controllers/calendar_events_api_controller.rb @@ -649,7 +649,7 @@ class CalendarEventsApiController < ApplicationController if params_for_update[:description].present? params_for_update[:description] = process_incoming_html_content(params_for_update[:description]) end - if @event.update_attributes(params_for_update) + if @event.update(params_for_update) render :json => event_json(@event, @current_user, session) else render :json => @event.errors, :status => :bad_request diff --git a/app/controllers/calendar_events_controller.rb b/app/controllers/calendar_events_controller.rb index 62d623310ed..4edecb4baad 100644 --- a/app/controllers/calendar_events_controller.rb +++ b/app/controllers/calendar_events_controller.rb @@ -74,7 +74,7 @@ class CalendarEventsController < ApplicationController def edit @event = @context.calendar_events.find(params[:id]) if @event.grants_right?(@current_user, session, :update) - @event.update_attributes!(params.permit(:title, :start_at, :end_at, :location_name, :location_address)) + @event.update!(params.permit(:title, :start_at, :end_at, :location_name, :location_address)) end if authorized_action(@event, @current_user, :update_content) render :new @@ -87,7 +87,7 @@ class CalendarEventsController < ApplicationController respond_to do |format| params[:calendar_event][:time_zone_edited] = Time.zone.name if params[:calendar_event] @event.updating_user = @current_user - if @event.update_attributes(calendar_event_params) + if @event.update(calendar_event_params) log_asset_access(@event, "calendar", "calendar", 'participate') flash[:notice] = t 'notices.updated', "Event was successfully updated." format.html { redirect_to calendar_url_for(@context) } diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index d6501f00c69..e67d30f7c6f 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -250,7 +250,7 @@ class ConferencesController < ApplicationController respond_to do |format| params[:web_conference].try(:delete, :long_running) params[:web_conference].try(:delete, :conference_type) - if @conference.update_attributes(conference_params) + if @conference.update(conference_params) # TODO: ability to dis-invite people members.uniq.each do |u| @conference.add_invitee(u) diff --git a/app/controllers/content_shares_controller.rb b/app/controllers/content_shares_controller.rb index 306cb4cd34e..0fdb8161180 100644 --- a/app/controllers/content_shares_controller.rb +++ b/app/controllers/content_shares_controller.rb @@ -272,7 +272,7 @@ class ContentSharesController < ApplicationController def update @content_share = @current_user.content_shares.find(params[:id]) update_params = params.permit(:read_state) - if @content_share.update_attributes(update_params) + if @content_share.update(update_params) render json: content_share_json(@content_share, @current_user, session) else render json: @content_share.errors.to_json, :status => 400 diff --git a/app/controllers/context_modules_api_controller.rb b/app/controllers/context_modules_api_controller.rb index f347f1a4ec7..f619ea34f6b 100644 --- a/app/controllers/context_modules_api_controller.rb +++ b/app/controllers/context_modules_api_controller.rb @@ -425,7 +425,7 @@ class ContextModulesApiController < ApplicationController end relock_warning = @module.relock_warning? - if @module.update_attributes(module_parameters) && set_position + if @module.update(module_parameters) && set_position json = module_json(@module, @current_user, session, nil) json['relock_warning'] = true if relock_warning || @module.relock_warning? json['publish_warning'] = publish_warning.present? diff --git a/app/controllers/context_modules_controller.rb b/app/controllers/context_modules_controller.rb index af259f93381..5597d9305b4 100644 --- a/app/controllers/context_modules_controller.rb +++ b/app/controllers/context_modules_controller.rb @@ -648,7 +648,7 @@ class ContextModulesController < ApplicationController elsif params[:unpublish] @module.unpublish end - if @module.update_attributes(context_module_params) + if @module.update(context_module_params) json = @module.as_json(:include => :content_tags, :methods => :workflow_state, :permissions => {:user => @current_user, :session => session}) json['context_module']['relock_warning'] = true if @module.relock_warning? render :json => json diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index ddf6c2d8f75..0092736bf39 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -646,7 +646,7 @@ class ConversationsController < ApplicationController # "participants": [{"id": 1, "name": "Joe", "full_name": "Joe TA"}] # } def update - if @conversation.update_attributes(params.require(:conversation).permit(*API_ALLOWED_FIELDS)) + if @conversation.update(params.require(:conversation).permit(*API_ALLOWED_FIELDS)) render :json => conversation_json(@conversation, @current_user, session) else render :json => @conversation.errors, :status => :bad_request diff --git a/app/controllers/discussion_entries_controller.rb b/app/controllers/discussion_entries_controller.rb index fe1096977af..e7178b325a0 100644 --- a/app/controllers/discussion_entries_controller.rb +++ b/app/controllers/discussion_entries_controller.rb @@ -108,7 +108,7 @@ class DiscussionEntriesController < ApplicationController return if context_file_quota_exceeded? @entry.editor = @current_user respond_to do |format| - if @entry.update_attributes(entry_params) + if @entry.update(entry_params) save_attachment format.html { flash[:notice] = t :updated_entry_notice, 'Entry was successfully updated.' diff --git a/app/controllers/discussion_topics_controller.rb b/app/controllers/discussion_topics_controller.rb index 4cd8f6e1fb5..07be2c6d0db 100644 --- a/app/controllers/discussion_topics_controller.rb +++ b/app/controllers/discussion_topics_controller.rb @@ -1216,7 +1216,7 @@ class DiscussionTopicsController < ApplicationController @topic.assignment = nil end end - @topic.update_attributes(discussion_topic_hash) + @topic.update(discussion_topic_hash) @topic.root_topic.try(:save) end if !@topic.errors.any? && !@topic.root_topic.try(:errors).try(:any?) diff --git a/app/controllers/eportfolio_categories_controller.rb b/app/controllers/eportfolio_categories_controller.rb index 26c515e44dd..751f99610a0 100644 --- a/app/controllers/eportfolio_categories_controller.rb +++ b/app/controllers/eportfolio_categories_controller.rb @@ -47,7 +47,7 @@ class EportfolioCategoriesController < ApplicationController if authorized_action(@portfolio, @current_user, :update) @category = @portfolio.eportfolio_categories.find(params[:id]) respond_to do |format| - if @category.update_attributes(eportfolio_category_params) + if @category.update(eportfolio_category_params) format.html { redirect_to eportfolio_category_url(@portfolio, @category) } format.json { render :json => @category } else diff --git a/app/controllers/eportfolio_entries_controller.rb b/app/controllers/eportfolio_entries_controller.rb index 225012dadc6..7320f70c638 100644 --- a/app/controllers/eportfolio_entries_controller.rb +++ b/app/controllers/eportfolio_entries_controller.rb @@ -79,7 +79,7 @@ class EportfolioEntriesController < ApplicationController entry_params[:eportfolio_category] = category end respond_to do |format| - if @entry.update_attributes!(entry_params) + if @entry.update!(entry_params) format.html { redirect_to eportfolio_entry_url(@portfolio, @entry) } format.json { render :json => @entry } else diff --git a/app/controllers/eportfolios_controller.rb b/app/controllers/eportfolios_controller.rb index b23a3bfd0ff..0efd73f01d1 100644 --- a/app/controllers/eportfolios_controller.rb +++ b/app/controllers/eportfolios_controller.rb @@ -118,7 +118,7 @@ class EportfoliosController < ApplicationController if update_params respond_to do |format| - if @portfolio.update_attributes(update_params) + if @portfolio.update(update_params) @portfolio.ensure_defaults flash[:notice] = t('notices.updated', "ePortfolio successfully updated") format.html { redirect_to eportfolio_url(@portfolio) } diff --git a/app/controllers/folders_controller.rb b/app/controllers/folders_controller.rb index a62bed9a499..6dbc07ab98f 100644 --- a/app/controllers/folders_controller.rb +++ b/app/controllers/folders_controller.rb @@ -333,7 +333,7 @@ class FoldersController < ApplicationController return unless authorized_action(parent_folder, @current_user, :manage_contents) folder_params[:parent_folder] = parent_folder end - if @folder.update_attributes(folder_params) + if @folder.update(folder_params) if !@folder.parent_folder_id || !@context.folders.where(id: @folder).first @folder.parent_folder = Folder.root_folders(@context).first @folder.save diff --git a/app/controllers/grading_periods_controller.rb b/app/controllers/grading_periods_controller.rb index adb89dae31a..0e88d7542f6 100644 --- a/app/controllers/grading_periods_controller.rb +++ b/app/controllers/grading_periods_controller.rb @@ -139,7 +139,7 @@ class GradingPeriodsController < ApplicationController respond_to do |format| DueDateCacher.with_executing_user(@current_user) do - if grading_period(inherit: false).update_attributes(grading_period_params) + if grading_period(inherit: false).update(grading_period_params) format.json { render json: serialize_json_api(grading_period(inherit: false)) } else format.json do diff --git a/app/controllers/grading_standards_controller.rb b/app/controllers/grading_standards_controller.rb index 66483bb3953..bdd86a4e2f7 100644 --- a/app/controllers/grading_standards_controller.rb +++ b/app/controllers/grading_standards_controller.rb @@ -80,7 +80,7 @@ class GradingStandardsController < ApplicationController if authorized_action(@standard, @current_user, :manage) @standard.user = @current_user respond_to do |format| - if @standard.update_attributes(grading_standard_params) + if @standard.update(grading_standard_params) format.json { render json: standard_as_json(@standard) } else format.json { render json: @standard.errors, status: :bad_request } diff --git a/app/controllers/group_memberships_controller.rb b/app/controllers/group_memberships_controller.rb index 3f1beedc995..12c18596f7e 100644 --- a/app/controllers/group_memberships_controller.rb +++ b/app/controllers/group_memberships_controller.rb @@ -190,7 +190,7 @@ class GroupMembershipsController < ApplicationController attrs.delete(:workflow_state) unless attrs[:workflow_state] == 'accepted' DueDateCacher.with_executing_user(@current_user) do - if @membership.update_attributes(attrs) + if @membership.update(attrs) render :json => group_membership_json(@membership, @current_user, session) else render :json => @membership.errors, :status => :bad_request diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c62fcf8b7b1..50c4a526507 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -581,7 +581,7 @@ class GroupsController < ApplicationController end respond_to do |format| @group.transaction do - @group.update_attributes(attrs.slice(*SETTABLE_GROUP_ATTRIBUTES)) + @group.update(attrs.slice(*SETTABLE_GROUP_ATTRIBUTES)) if attrs[:members] user_ids = Api.value_to_array(attrs[:members]).map(&:to_i).uniq if @group.context diff --git a/app/controllers/lti/ims/line_items_controller.rb b/app/controllers/lti/ims/line_items_controller.rb index adae87951f1..acbb86655f0 100644 --- a/app/controllers/lti/ims/line_items_controller.rb +++ b/app/controllers/lti/ims/line_items_controller.rb @@ -163,7 +163,7 @@ module Lti # # @returns LineItem def update - line_item.update_attributes!(line_item_params) + line_item.update!(line_item_params) update_assignment_title if line_item.assignment_line_item? render json: LineItemsSerializer.new(line_item, line_item_id(line_item)), content_type: MIME_TYPE @@ -238,7 +238,7 @@ module Lti def update_assignment_title return if line_item_params[:label].blank? - line_item.assignment.update_attributes!(name: line_item_params[:label]) + line_item.assignment.update!(name: line_item_params[:label]) end def resource_link diff --git a/app/controllers/lti/originality_reports_api_controller.rb b/app/controllers/lti/originality_reports_api_controller.rb index c7856c71586..ffe0d79a071 100644 --- a/app/controllers/lti/originality_reports_api_controller.rb +++ b/app/controllers/lti/originality_reports_api_controller.rb @@ -236,7 +236,7 @@ module Lti # # @returns OriginalityReport def update - if @report.update_attributes(update_report_params) + if @report.update(update_report_params) @report.send_later_if_production(:copy_to_group_submissions!) render json: api_json(@report, @current_user, session) else diff --git a/app/controllers/media_tracks_controller.rb b/app/controllers/media_tracks_controller.rb index e824a4760d7..01a40e28282 100644 --- a/app/controllers/media_tracks_controller.rb +++ b/app/controllers/media_tracks_controller.rb @@ -47,7 +47,7 @@ class MediaTracksController < ApplicationController @media_object = MediaObject.active.by_media_id(params[:media_object_id]).first if authorized_action(@media_object, @current_user, :add_captions) track = @media_object.media_tracks.where(user_id: @current_user.id, locale: params[:locale]).first_or_initialize - track.update_attributes! params.permit(*TRACK_SETTABLE_ATTRIBUTES) + track.update! params.permit(*TRACK_SETTABLE_ATTRIBUTES) render :json => media_object_api_json(@media_object, @current_user, session) end end diff --git a/app/controllers/outcome_groups_api_controller.rb b/app/controllers/outcome_groups_api_controller.rb index 1fb617e5635..dbeda4df313 100644 --- a/app/controllers/outcome_groups_api_controller.rb +++ b/app/controllers/outcome_groups_api_controller.rb @@ -265,7 +265,7 @@ class OutcomeGroupsApiController < ApplicationController render :json => 'error'.to_json, :status => :bad_request return end - @outcome_group.update_attributes(params.permit(:title, :description, :vendor_guid)) + @outcome_group.update(params.permit(:title, :description, :vendor_guid)) if params[:parent_outcome_group_id] && params[:parent_outcome_group_id] != @outcome_group.learning_outcome_group_id new_parent = context_outcome_groups.find(params[:parent_outcome_group_id]) unless new_parent.adopt_outcome_group(@outcome_group) diff --git a/app/controllers/outcomes_api_controller.rb b/app/controllers/outcomes_api_controller.rb index dd799a3e168..9b281d754ab 100644 --- a/app/controllers/outcomes_api_controller.rb +++ b/app/controllers/outcomes_api_controller.rb @@ -267,7 +267,7 @@ class OutcomesApiController < ApplicationController return unless authorized_action(@outcome, @current_user, :update) update_outcome_criterion(@outcome) if params[:mastery_points] || params[:ratings] - if @outcome.update_attributes(params.permit(*DIRECT_PARAMS)) + if @outcome.update(params.permit(*DIRECT_PARAMS)) render :json => outcome_json(@outcome, @current_user, session) else render :json => @outcome.errors, :status => :bad_request diff --git a/app/controllers/outcomes_controller.rb b/app/controllers/outcomes_controller.rb index dda10457dcb..a18b4e50a62 100644 --- a/app/controllers/outcomes_controller.rb +++ b/app/controllers/outcomes_controller.rb @@ -267,7 +267,7 @@ class OutcomesController < ApplicationController @outcome = @context.created_learning_outcomes.find(params[:id]) respond_to do |format| - if @outcome.update_attributes(learning_outcome_params) + if @outcome.update(learning_outcome_params) flash[:notice] = t :successful_outcome_update, "Outcome successfully updated!" format.html { redirect_to named_context_url(@context, :context_outcomes_url) } format.json { render :json => @outcome } diff --git a/app/controllers/planner_notes_controller.rb b/app/controllers/planner_notes_controller.rb index 61cf87fe8b5..2f8b119629f 100644 --- a/app/controllers/planner_notes_controller.rb +++ b/app/controllers/planner_notes_controller.rb @@ -210,7 +210,7 @@ class PlannerNotesController < ApplicationController update_params[:course] = nil end end - if note.update_attributes(update_params) + if note.update(update_params) Rails.cache.delete(planner_meta_cache_key) render json: planner_note_json(note, @current_user, session), status: :ok else diff --git a/app/controllers/polling/poll_choices_controller.rb b/app/controllers/polling/poll_choices_controller.rb index b7f00e4d8aa..3d380941069 100644 --- a/app/controllers/polling/poll_choices_controller.rb +++ b/app/controllers/polling/poll_choices_controller.rb @@ -151,7 +151,7 @@ module Polling end if authorized_action(@poll, @current_user, :update) - if @poll_choice.update_attributes(poll_choice_params) + if @poll_choice.update(poll_choice_params) render json: serialize_jsonapi(@poll_choice) else render json: @poll_choice.errors, status: :bad_request diff --git a/app/controllers/polling/poll_sessions_controller.rb b/app/controllers/polling/poll_sessions_controller.rb index 84d11f42ecc..e4656190146 100644 --- a/app/controllers/polling/poll_sessions_controller.rb +++ b/app/controllers/polling/poll_sessions_controller.rb @@ -179,7 +179,7 @@ module Polling def update @poll_session = @poll.poll_sessions.find(params[:id]) if authorized_action(@poll, @current_user, :update) - if @poll_session.update_attributes(get_poll_session_params) + if @poll_session.update(get_poll_session_params) render json: serialize_jsonapi(@poll_session) else render json: @poll_session.errors, status: :bad_request diff --git a/app/controllers/polling/polls_controller.rb b/app/controllers/polling/polls_controller.rb index 0c38a4c45ce..103c4256315 100644 --- a/app/controllers/polling/polls_controller.rb +++ b/app/controllers/polling/polls_controller.rb @@ -144,7 +144,7 @@ module Polling if authorized_action(@poll, @current_user, :update) poll_params.delete(:is_correct) if poll_params && poll_params[:is_correct].blank? - if @poll.update_attributes(poll_params) + if @poll.update(poll_params) render json: serialize_jsonapi(@poll) else render json: @poll.errors, status: :bad_request diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 265c2437040..79602ed76ca 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -343,7 +343,7 @@ class ProfileController < ApplicationController user_params.delete(:short_name) user_params.delete(:sortable_name) end - if @user.update_attributes(user_params) + if @user.update(user_params) pseudonymed = false if params[:default_email_id].present? @email_channel = @user.communication_channels.email.active.where(id: params[:default_email_id]).first @@ -373,7 +373,7 @@ class ProfileController < ApplicationController pseudonym_params.delete :password_confirmation end params[:pseudonym].delete :password_id - if !pseudonym_params.empty? && pseudonym_to_update && !pseudonym_to_update.update_attributes(pseudonym_params) + if !pseudonym_params.empty? && pseudonym_to_update && !pseudonym_to_update.update(pseudonym_params) pseudonymed = true flash[:error] = t('errors.profile_update_failed', "Login failed to update") format.html { redirect_to user_profile_url(@current_user) } diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 1422f66bde9..53e25fe10b3 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -134,7 +134,7 @@ class QuestionBanksController < ApplicationController def update @bank = @context.assessment_question_banks.find(params[:id]) if authorized_action(@bank, @current_user, :update) - if @bank.update_attributes(bank_params) + if @bank.update(bank_params) @bank.reload render :json => @bank.as_json(:include => {:learning_outcome_alignments => {:include => {:learning_outcome => {:include_root => false}}}}) else diff --git a/app/controllers/quizzes/quizzes_controller.rb b/app/controllers/quizzes/quizzes_controller.rb index edce775b284..2eb8128e2e9 100644 --- a/app/controllers/quizzes/quizzes_controller.rb +++ b/app/controllers/quizzes/quizzes_controller.rb @@ -395,7 +395,7 @@ class Quizzes::QuizzesController < ApplicationController @quiz.content_being_saved_by(@current_user) @quiz.infer_times @quiz.transaction do - @quiz.update_attributes!(quiz_params) + @quiz.update!(quiz_params) batch_update_assignment_overrides(@quiz, overrides, @current_user) unless overrides.nil? end diff --git a/app/controllers/sections_controller.rb b/app/controllers/sections_controller.rb index d6077d44ac5..af0b521cd1f 100644 --- a/app/controllers/sections_controller.rb +++ b/app/controllers/sections_controller.rb @@ -280,7 +280,7 @@ class SectionsController < ApplicationController end respond_to do |format| - if @section.update_attributes(course_section_params) + if @section.update(course_section_params) @context.touch flash[:notice] = t('section_updated', "Section successfully updated!") format.html { redirect_to course_section_url(@context, @section) } diff --git a/app/controllers/sub_accounts_controller.rb b/app/controllers/sub_accounts_controller.rb index a66e33fb506..70034cdf116 100644 --- a/app/controllers/sub_accounts_controller.rb +++ b/app/controllers/sub_accounts_controller.rb @@ -147,7 +147,7 @@ class SubAccountsController < ApplicationController def update @sub_account = subaccount_or_self(params[:id]) params[:account].delete(:parent_account_id) - if @sub_account.update_attributes(account_params) + if @sub_account.update(account_params) render :json => account_json(@sub_account, @current_user, session, []) else render :json => @sub_account.errors, status: 400 diff --git a/app/controllers/terms_controller.rb b/app/controllers/terms_controller.rb index 5c0ea5b881d..0218367e126 100644 --- a/app/controllers/terms_controller.rb +++ b/app/controllers/terms_controller.rb @@ -134,7 +134,7 @@ class TermsController < ApplicationController term_params = params.require(:enrollment_term).permit(:name, :start_at, :end_at) DueDateCacher.with_executing_user(@current_user) do - if validate_dates(@term, term_params, overrides) && @term.update_attributes(term_params) + if validate_dates(@term, term_params, overrides) && @term.update(term_params) @term.set_overrides(@context, overrides) render :json => serialized_term else diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index 92505feec39..5d7943fa9e6 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -44,7 +44,7 @@ class TokensController < ApplicationController def update @token = @current_user.access_tokens.find(params[:id]) - if @token.update_attributes(access_token_params) + if @token.update(access_token_params) render :json => @token.as_json(:include_root => false, :methods => [:app_name,:visible_token]) else render :json => @token.errors, :status => :bad_request diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ffc83c65f14..aab5dee89c5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1919,7 +1919,7 @@ class UsersController < ApplicationController @user.sortable_name_explicitly_set = user_params[:sortable_name].present? respond_to do |format| - if @user.update_attributes(user_params) + if @user.update(user_params) @user.avatar_state = (old_avatar_state == :locked ? old_avatar_state : 'approved') if admin_avatar_update @user.profile.save if @user.profile.changed? @user.save if admin_avatar_update || update_email diff --git a/app/controllers/wiki_pages_api_controller.rb b/app/controllers/wiki_pages_api_controller.rb index 5e2a7432fe7..d8d01ac0151 100644 --- a/app/controllers/wiki_pages_api_controller.rb +++ b/app/controllers/wiki_pages_api_controller.rb @@ -326,7 +326,7 @@ class WikiPagesApiController < ApplicationController if authorized_action(@page, @current_user, :create) update_params = get_update_params(Set[:title, :body]) assign_todo_date - if !update_params.is_a?(Symbol) && @page.update_attributes(update_params) && process_front_page + if !update_params.is_a?(Symbol) && @page.update(update_params) && process_front_page log_asset_access(@page, "wiki", @wiki, 'participate') apply_assignment_parameters(assignment_params, @page) if @context.feature_enabled?(:conditional_release) render :json => wiki_page_json(@page, @current_user, session) @@ -398,7 +398,7 @@ class WikiPagesApiController < ApplicationController if perform_update assign_todo_date update_params = get_update_params - if !update_params.is_a?(Symbol) && @page.update_attributes(update_params) && process_front_page + if !update_params.is_a?(Symbol) && @page.update(update_params) && process_front_page log_asset_access(@page, "wiki", @wiki, 'participate') @page.context_module_action(@current_user, @context, :contributed) apply_assignment_parameters(assignment_params, @page) if @context.feature_enabled?(:conditional_release) diff --git a/app/models/account_report_runner.rb b/app/models/account_report_runner.rb index 49f1620caa0..7af88d75972 100644 --- a/app/models/account_report_runner.rb +++ b/app/models/account_report_runner.rb @@ -48,22 +48,22 @@ class AccountReportRunner < ActiveRecord::Base def start @rows ||= [] - self.update_attributes!(workflow_state: 'running', started_at: Time.now.utc) + self.update!(workflow_state: 'running', started_at: Time.now.utc) end def complete write_rows - self.update_attributes!(workflow_state: 'completed', ended_at: Time.now.utc) + self.update!(workflow_state: 'completed', ended_at: Time.now.utc) end def abort write_rows - self.update_attributes!(workflow_state: 'aborted', ended_at: Time.now.utc) + self.update!(workflow_state: 'aborted', ended_at: Time.now.utc) end def fail write_rows - self.update_attributes!(workflow_state: 'error', ended_at: Time.now.utc) + self.update!(workflow_state: 'error', ended_at: Time.now.utc) end scope :in_progress, -> {where(workflow_state: %w(running))} diff --git a/app/models/assessment_request.rb b/app/models/assessment_request.rb index 9176935729f..f813c3a52de 100644 --- a/app/models/assessment_request.rb +++ b/app/models/assessment_request.rb @@ -147,7 +147,7 @@ class AssessmentRequest < ActiveRecord::Base def update_planner_override if saved_change_to_workflow_state? && workflow_state_before_last_save == 'assigned' && workflow_state == 'completed' override = PlannerOverride.find_by(plannable_id: self.id, plannable_type: 'AssessmentRequest', user: assessor) - override.update_attributes(marked_complete: true) if override.present? + override.update(marked_complete: true) if override.present? end end end diff --git a/app/models/assignment_configuration_tool_lookup.rb b/app/models/assignment_configuration_tool_lookup.rb index a405585d55a..53a234f1c35 100644 --- a/app/models/assignment_configuration_tool_lookup.rb +++ b/app/models/assignment_configuration_tool_lookup.rb @@ -122,6 +122,6 @@ class AssignmentConfigurationToolLookup < ActiveRecord::Base return unless lti_tool.instance_of? Lti::MessageHandler tool_proxy = lti_tool.resource_handler.tool_proxy subscription_helper = Lti::AssignmentSubscriptionsHelper.new(tool_proxy, assignment) - self.update_attributes(subscription_id: subscription_helper.create_subscription) + self.update(subscription_id: subscription_helper.create_subscription) end end diff --git a/app/models/calendar_event.rb b/app/models/calendar_event.rb index aef04ebdb3b..a9ad077028c 100644 --- a/app/models/calendar_event.rb +++ b/app/models/calendar_event.rb @@ -96,7 +96,7 @@ class CalendarEvent < ActiveRecord::Base @child_event_data.each do |data| if (event = current_events.delete(data[:context_code])&.first) event.updating_user = @updating_user - event.update_attributes(:start_at => data[:start_at], :end_at => data[:end_at]) + event.update(:start_at => data[:start_at], :end_at => data[:end_at]) else context = @child_event_contexts[data[:context_code]][0] event = child_events.build(:start_at => data[:start_at], :end_at => data[:end_at]) diff --git a/app/models/context.rb b/app/models/context.rb index 252164005da..8405334d643 100644 --- a/app/models/context.rb +++ b/app/models/context.rb @@ -65,7 +65,7 @@ module Context user = entry.user || feed.user # If already existed and has been updated if entry.entry_changed? && entry.asset - entry.asset.update_attributes( + entry.asset.update( :title => entry.title, :message => entry.message ) @@ -77,7 +77,7 @@ module Context announcement.external_feed_id = feed.id announcement.user = user announcement.save - entry.update_attributes(:asset => announcement) + entry.update(:asset => announcement) end end end diff --git a/app/models/conversation_participant.rb b/app/models/conversation_participant.rb index dfc5a7210b7..10a31938537 100644 --- a/app/models/conversation_participant.rb +++ b/app/models/conversation_participant.rb @@ -356,7 +356,7 @@ class ConversationParticipant < ActiveRecord::Base StreamItem.send_later_if_production_enqueue_args(:generate_or_update, {:priority => 25}, self.conversation) end - def update_attributes(hash) + def update(hash) # subscribed= can update the workflow_state, but an explicit # workflow_state should trump that. so we do this first subscribed = (hash.has_key?(:subscribed) ? hash.delete(:subscribed) : hash.delete('subscribed')) diff --git a/app/models/crocodoc_document.rb b/app/models/crocodoc_document.rb index 66b3d934473..97ddeb2ff14 100644 --- a/app/models/crocodoc_document.rb +++ b/app/models/crocodoc_document.rb @@ -52,7 +52,7 @@ class CrocodocDocument < ActiveRecord::Base end if response && response['uuid'] - update_attributes :uuid => response['uuid'], :process_state => 'QUEUED' + update :uuid => response['uuid'], :process_state => 'QUEUED' elsif response.nil? raise "no response received" else diff --git a/app/models/discussion_entry.rb b/app/models/discussion_entry.rb index 44eb513d1fe..db77c6e0318 100644 --- a/app/models/discussion_entry.rb +++ b/app/models/discussion_entry.rb @@ -391,7 +391,7 @@ class DiscussionEntry < ActiveRecord::Base end end if existing_topic_participant && !existing_topic_participant.subscribed? && !self.discussion_topic.subscription_hold(user, nil, nil) - existing_topic_participant.update_attributes!(:subscribed => true) + existing_topic_participant.update!(:subscribed => true) end end end diff --git a/app/models/external_feed_entry.rb b/app/models/external_feed_entry.rb index d93054bbcb6..8b706d23e10 100644 --- a/app/models/external_feed_entry.rb +++ b/app/models/external_feed_entry.rb @@ -40,7 +40,7 @@ class ExternalFeedEntry < ActiveRecord::Base protected :infer_defaults def update_feed_attributes(opts) - self.update_attributes(opts) + self.update(opts) @feed_entry_updated = self.changed? end diff --git a/app/models/google_docs_collaboration.rb b/app/models/google_docs_collaboration.rb index 4329508cee9..ab85b02e88b 100644 --- a/app/models/google_docs_collaboration.rb +++ b/app/models/google_docs_collaboration.rb @@ -68,7 +68,7 @@ class GoogleDocsCollaboration < Collaboration user_param = service_user_id google_adapter_for_user.acl_add(self.document_id, [user_param]) - collaborator.update_attributes(:authorized_service_user_id => service_user_id) + collaborator.update(:authorized_service_user_id => service_user_id) end else # no collaboration for this user, lets create it diff --git a/app/models/importers/assignment_importer.rb b/app/models/importers/assignment_importer.rb index 176e1a47878..c6f328798cf 100644 --- a/app/models/importers/assignment_importer.rb +++ b/app/models/importers/assignment_importer.rb @@ -98,7 +98,7 @@ module Importers context: assignment.course ) - tool_setting.update_attributes!( + tool_setting.update!( custom: ts_custom, custom_parameters: ts_custom_params, vendor_code: ts_vendor_code, diff --git a/app/models/parallel_importer.rb b/app/models/parallel_importer.rb index e53059b947f..53b2abdf25a 100644 --- a/app/models/parallel_importer.rb +++ b/app/models/parallel_importer.rb @@ -38,22 +38,22 @@ class ParallelImporter < ActiveRecord::Base def start if workflow_state == 'retry' - self.update_attributes!(started_at: Time.now.utc) + self.update!(started_at: Time.now.utc) else - self.update_attributes!(:workflow_state => "running", :started_at => Time.now.utc) + self.update!(:workflow_state => "running", :started_at => Time.now.utc) end end def fail - self.update_attributes!(:workflow_state => "failed", :ended_at => Time.now.utc) + self.update!(:workflow_state => "failed", :ended_at => Time.now.utc) end def abort - self.update_attributes!(:workflow_state => "aborted", :ended_at => Time.now.utc) + self.update!(:workflow_state => "aborted", :ended_at => Time.now.utc) end def complete(opts={}) updates = {:workflow_state => "completed", :ended_at => Time.now.utc}.merge(opts) - self.update_attributes!(updates) + self.update!(updates) end end diff --git a/app/models/rubric_association.rb b/app/models/rubric_association.rb index bdbbb2ba106..91a761e3231 100644 --- a/app/models/rubric_association.rb +++ b/app/models/rubric_association.rb @@ -245,7 +245,7 @@ class RubricAssociation < ActiveRecord::Base end association.context = context association.skip_updating_points_possible = params.delete :skip_updating_points_possible - association.update_attributes(params) + association.update(params) association.association_object = association_object association end diff --git a/app/models/submission_comment.rb b/app/models/submission_comment.rb index c5d36632e04..f3aadbad17c 100644 --- a/app/models/submission_comment.rb +++ b/app/models/submission_comment.rb @@ -92,7 +92,7 @@ class SubmissionComment < ActiveRecord::Base def publish_other_comments_in_this_group return unless saved_change_to_draft? update_other_comments_in_this_group do |comment| - comment.update_attributes(draft: draft) + comment.update(draft: draft) end end diff --git a/gems/bookmarked_collection/spec/bookmarked_collection/bookmarked_collection_spec.rb b/gems/bookmarked_collection/spec/bookmarked_collection/bookmarked_collection_spec.rb index d87b4e84bf6..2be81ee21a6 100644 --- a/gems/bookmarked_collection/spec/bookmarked_collection/bookmarked_collection_spec.rb +++ b/gems/bookmarked_collection/spec/bookmarked_collection/bookmarked_collection_spec.rb @@ -93,7 +93,7 @@ describe "BookmarkedCollection" do it "should apply any restriction block given to the scope" do course = @scope.order(:id).last - course.update_attributes(:name => 'Matching Name') + course.update(:name => 'Matching Name') collection = BookmarkedCollection.wrap(IDBookmarker, @scope) do |scope| scope.where(:name => course.name) diff --git a/gems/canvas_stringex/spec/lucky_sneaks/acts_as_url_spec.rb b/gems/canvas_stringex/spec/lucky_sneaks/acts_as_url_spec.rb index efecd7fae02..7661f9e5cef 100644 --- a/gems/canvas_stringex/spec/lucky_sneaks/acts_as_url_spec.rb +++ b/gems/canvas_stringex/spec/lucky_sneaks/acts_as_url_spec.rb @@ -109,14 +109,14 @@ describe "ActsAsUrl" do it "should_not_update_url_by_default" do @doc = Document.create!(:title => "Stable as Stone") @original_url = @doc.url - @doc.update_attributes :title => "New Unstable Madness" + @doc.update :title => "New Unstable Madness" expect(@original_url).to eq @doc.url end it "should_update_url_if_asked" do @moc = Mocument.create!(:title => "Original") @original_url = @moc.url - @moc.update_attributes :title => "New and Improved" + @moc.update :title => "New and Improved" expect(@original_url).to_not eq @moc.url end diff --git a/gems/plugins/account_reports/lib/account_reports.rb b/gems/plugins/account_reports/lib/account_reports.rb index 397648858c4..aacf38f5beb 100644 --- a/gems/plugins/account_reports/lib/account_reports.rb +++ b/gems/plugins/account_reports/lib/account_reports.rb @@ -79,7 +79,7 @@ module AccountReports end def self.generate_report(account_report) - account_report.update_attributes(workflow_state: 'running', start_at: Time.zone.now) + account_report.update(workflow_state: 'running', start_at: Time.zone.now) begin REPORTS[account_report.report_type].proc.call(account_report) rescue => e diff --git a/gems/plugins/account_reports/lib/account_reports/report_helper.rb b/gems/plugins/account_reports/lib/account_reports/report_helper.rb index 1fecd38125a..ae2134e7ce6 100644 --- a/gems/plugins/account_reports/lib/account_reports/report_helper.rb +++ b/gems/plugins/account_reports/lib/account_reports/report_helper.rb @@ -312,7 +312,7 @@ module AccountReports::ReportHelper return end - @account_report.update_attributes(total_lines: total_runners) + @account_report.update(total_lines: total_runners) args = {priority: Delayed::LOW_PRIORITY, max_attempts: 1, n_strand: ["account_report_runner", root_account.global_id]} @account_report.account_report_runners.find_each do |runner| @@ -379,7 +379,7 @@ module AccountReports::ReportHelper end def compile_parallel_report(headers, files: nil) - @account_report.update_attributes(total_lines: @account_report.account_report_rows.count + 1) + @account_report.update(total_lines: @account_report.account_report_rows.count + 1) files ? compile_parallel_zip_report(files) : write_report_from_rows(headers) @account_report.delete_account_report_rows end @@ -465,7 +465,7 @@ module AccountReports::ReportHelper updates = {} updates[:current_line] = lineno updates[:progress] = (lineno.to_f / (report.total_lines + 1) * 100).to_i if report.total_lines - report.update_attributes(updates) + report.update(updates) if report.workflow_state == 'deleted' report.workflow_state = 'aborted' report.save! diff --git a/gems/plugins/simply_versioned/lib/simply_versioned.rb b/gems/plugins/simply_versioned/lib/simply_versioned.rb index 37b9fe3b60e..4963b32d234 100644 --- a/gems/plugins/simply_versioned/lib/simply_versioned.rb +++ b/gems/plugins/simply_versioned/lib/simply_versioned.rb @@ -138,7 +138,7 @@ module SimplyVersioned options[:except] = options[:except].map( &:to_s ) - self.update_attributes( YAML::load( version.yaml ).except( *options[:except] ) ) + self.update( YAML::load( version.yaml ).except( *options[:except] ) ) end # Invoke the supplied block passing the receiver as the sole block argument with diff --git a/lib/canvas/message_helper.rb b/lib/canvas/message_helper.rb index 17e27be20bf..30bb4c9abb2 100644 --- a/lib/canvas/message_helper.rb +++ b/lib/canvas/message_helper.rb @@ -79,7 +79,7 @@ module Canvas::MessageHelper raise 'Name is required' unless using[:name] n = Notification.where(name: using[:name]).first_or_initialize begin - n.update_attributes(:delay_for => using[:delay_for], :category => using[:category]) + n.update(:delay_for => using[:delay_for], :category => using[:category]) rescue => e if n.new_record? raise "New notification '#{using[:name]}' creation failed. Message: #{e.message}" diff --git a/lib/data_fixup/add_tool_proxy_to_message_handler.rb b/lib/data_fixup/add_tool_proxy_to_message_handler.rb index 20597957dd1..86945701bb2 100644 --- a/lib/data_fixup/add_tool_proxy_to_message_handler.rb +++ b/lib/data_fixup/add_tool_proxy_to_message_handler.rb @@ -18,7 +18,7 @@ module DataFixup::AddToolProxyToMessageHandler def self.run Lti::MessageHandler.where(tool_proxy: nil).find_each do |mh| - mh.update_attributes(tool_proxy: mh.resource_handler.tool_proxy) + mh.update(tool_proxy: mh.resource_handler.tool_proxy) end end end diff --git a/lib/data_fixup/populate_root_account_id_on_user_observers.rb b/lib/data_fixup/populate_root_account_id_on_user_observers.rb index cd00c87832c..cd56ebd8661 100644 --- a/lib/data_fixup/populate_root_account_id_on_user_observers.rb +++ b/lib/data_fixup/populate_root_account_id_on_user_observers.rb @@ -31,13 +31,13 @@ module DataFixup::PopulateRootAccountIdOnUserObservers # for the unlikely scenario that somehow an equivalent link was made after the deploy but before the fixup finished new_id = -1 * retry_count # just in case updates = {:root_account_id => new_id, :workflow_state => 'deleted'} - shadow.update_attributes(updates) if shadow - link.update_attributes(updates) + shadow.update(updates) if shadow + link.update(updates) else updates = {:root_account_id => root_account_id} updates.merge!(:workflow_state => 'deleted') if destroy - shadow.update_attributes(updates) if shadow - link.update_attributes(updates) + shadow.update(updates) if shadow + link.update(updates) end end end diff --git a/lib/planner_helper.rb b/lib/planner_helper.rb index 495e2df28b9..e303f50c2ba 100644 --- a/lib/planner_helper.rb +++ b/lib/planner_helper.rb @@ -62,7 +62,7 @@ module PlannerHelper def self.complete_planner_override(planner_override) return unless planner_override.is_a? PlannerOverride - planner_override.update_attributes(marked_complete: true) + planner_override.update(marked_complete: true) clear_planner_cache(planner_override&.user) end diff --git a/spec/apis/lti/ims/tool_proxy_api_spec.rb b/spec/apis/lti/ims/tool_proxy_api_spec.rb index 40b102de605..fea7c30a6a3 100644 --- a/spec/apis/lti/ims/tool_proxy_api_spec.rb +++ b/spec/apis/lti/ims/tool_proxy_api_spec.rb @@ -173,7 +173,7 @@ module Lti describe "POST #create with JWT access token" do let(:access_token) do aud = host rescue (@request || request).host - developer_key.update_attributes(vendor_code: vendor_code) + developer_key.update(vendor_code: vendor_code) Lti::Oauth2::AccessToken.create_jwt(aud: aud, sub: developer_key.global_id, reg_key: 'reg_key') end let(:request_headers) { {Authorization: "Bearer #{access_token}"} } diff --git a/spec/apis/lti/originality_reports_api_spec.rb b/spec/apis/lti/originality_reports_api_spec.rb index 279118bdc87..3532baf8966 100644 --- a/spec/apis/lti/originality_reports_api_spec.rb +++ b/spec/apis/lti/originality_reports_api_spec.rb @@ -30,7 +30,7 @@ module Lti before(:once) { attachment_model } before :each do course_factory(active_all: true) - message_handler.update_attributes(message_type: 'basic-lti-launch-request') + message_handler.update(message_type: 'basic-lti-launch-request') student_in_course active_all: true teacher_in_course active_all: true @@ -78,7 +78,7 @@ module Lti @report = OriginalityReport.create!(report_initial_values) @endpoints[:show] = "/api/lti/assignments/#{@assignment.id}/submissions/#{@submission.id}/originality_report/#{@report.id}" @endpoints[:alt_show] = "/api/lti/assignments/#{@assignment.id}/files/#{@attachment.id}/originality_report" - @assignment.course.update_attributes(account: tool_proxy.context) + @assignment.course.update(account: tool_proxy.context) end it "requires an lti access token" do @@ -98,7 +98,7 @@ module Lti @assignment.save! new_tool_proxy = tool_proxy.deep_clone - new_tool_proxy.update_attributes(guid: SecureRandom.uuid) + new_tool_proxy.update(guid: SecureRandom.uuid) token = Lti::Oauth2::AccessToken.create_jwt(aud: aud, sub: new_tool_proxy.guid) other_helpers = {Authorization: "Bearer #{token}"} @@ -191,7 +191,7 @@ module Lti @assignment.tool_settings_tool = message_handler @assignment.save! new_tool_proxy = tool_proxy.deep_clone - new_tool_proxy.update_attributes(guid: SecureRandom.uuid) + new_tool_proxy.update(guid: SecureRandom.uuid) token = Lti::Oauth2::AccessToken.create_jwt(aud: aud, sub: new_tool_proxy.guid) other_helpers = {Authorization: "Bearer #{token}"} allow_any_instance_of(Lti::ToolProxy).to receive(:active_in_context?).and_return(true) @@ -273,7 +273,7 @@ module Lti @report = OriginalityReport.create!(report_initial_values) @endpoints[:update] = "/api/lti/assignments/#{@assignment.id}/submissions/#{@submission.id}/originality_report/#{@report.id}" @endpoints[:update_alt] = "/api/lti/assignments/#{@assignment.id}/files/#{@attachment.id}/originality_report" - @assignment.course.update_attributes(account: account) + @assignment.course.update(account: account) end it "requires the tool proxy to be associated to the assignment" do @@ -629,7 +629,7 @@ module Lti describe "POST assignments/:assignment_id/submissions/:submission_id/originality_report (#create)" do before do - @assignment.course.update_attributes(account: account) + @assignment.course.update(account: account) end it "creates an originality report when provided required params" do @@ -712,8 +712,8 @@ module Lti end it "does not require an attachment if submission type includes online text entry" do - @submission.assignment.update_attributes!(submission_types: 'online_text_entry') - @submission.update_attributes!(body: 'some text') + @submission.assignment.update!(submission_types: 'online_text_entry') + @submission.update!(body: 'some text') score = 0.25 post @endpoints[:create], params: {originality_report: {originality_score: score}}, headers: request_headers @@ -722,7 +722,7 @@ module Lti end it "does not requre an attachment if submission type does not include online text entry" do - @submission.update_attributes!(body: 'some text') + @submission.update!(body: 'some text') score = 0.25 post @endpoints[:create], params: {originality_report: {originality_score: score}}, headers: request_headers expect(response).to be_not_found @@ -885,7 +885,7 @@ module Lti context 'when attempt is given' do before do - @submission.assignment.update_attributes!(submission_types: 'online_text_entry') + @submission.assignment.update!(submission_types: 'online_text_entry') end def create_version @@ -974,7 +974,7 @@ module Lti context 'when attempt is not given' do it 'updates the first originality report created without an attachment' do - @submission.assignment.update_attributes!(submission_types: 'online_text_entry') + @submission.assignment.update!(submission_types: 'online_text_entry') originality_score = 50 post @endpoints[:create], params: { diff --git a/spec/apis/lti/plagiarism_assignments_api_controller_spec.rb b/spec/apis/lti/plagiarism_assignments_api_controller_spec.rb index 549f2514e0b..142762d26d9 100644 --- a/spec/apis/lti/plagiarism_assignments_api_controller_spec.rb +++ b/spec/apis/lti/plagiarism_assignments_api_controller_spec.rb @@ -29,7 +29,7 @@ module Lti before do allow_any_instance_of(AssignmentSubscriptionsHelper).to receive(:create_subscription) { SecureRandom.uuid } allow_any_instance_of(AssignmentSubscriptionsHelper).to receive(:destroy_subscription) { {} } - message_handler.update_attributes(capabilities: [Lti::ResourcePlacement::SIMILARITY_DETECTION_LTI2]) + message_handler.update(capabilities: [Lti::ResourcePlacement::SIMILARITY_DETECTION_LTI2]) tool_proxy.raw_data['security_contract']['tool_service'] = authorized_services tool_proxy.save! assignment.tool_settings_tool = message_handler @@ -44,7 +44,7 @@ module Lti end let(:student) do student = create_users_in_course(course, 2, return_type: :record).first - student.update_attributes(lti_context_id: SecureRandom.uuid) + student.update(lti_context_id: SecureRandom.uuid) student end let(:assignment) do diff --git a/spec/apis/lti/submissions_api_spec.rb b/spec/apis/lti/submissions_api_spec.rb index f82d81ee3d0..f253696e651 100644 --- a/spec/apis/lti/submissions_api_spec.rb +++ b/spec/apis/lti/submissions_api_spec.rb @@ -56,7 +56,7 @@ module Lti let(:other_tool_proxy) do tp = tool_proxy.dup - tp.update_attributes(guid: other_tp_guid) + tp.update(guid: other_tp_guid) tp end diff --git a/spec/apis/lti/users_api_spec.rb b/spec/apis/lti/users_api_spec.rb index d01acff82ac..ba6b6d98e5e 100644 --- a/spec/apis/lti/users_api_spec.rb +++ b/spec/apis/lti/users_api_spec.rb @@ -44,7 +44,7 @@ module Lti before do allow_any_instance_of(AssignmentSubscriptionsHelper).to receive(:create_subscription) { SecureRandom.uuid } allow_any_instance_of(AssignmentSubscriptionsHelper).to receive(:destroy_subscription) { {} } - message_handler.update_attributes(capabilities: [Lti::ResourcePlacement::SIMILARITY_DETECTION_LTI2]) + message_handler.update(capabilities: [Lti::ResourcePlacement::SIMILARITY_DETECTION_LTI2]) tool_proxy.raw_data['security_contract']['tool_service'] = authorized_services tool_proxy.save! assignment.tool_settings_tool = message_handler @@ -56,7 +56,7 @@ module Lti let(:canvas_id_endpoint) { "/api/lti/users/#{student.id}" } let(:student) do course_with_student(active_all: true, course: course) - @student.update_attributes(lti_context_id: SecureRandom.uuid) + @student.update(lti_context_id: SecureRandom.uuid) @student end let(:expected_student) do @@ -80,7 +80,7 @@ module Lti it "verifies the tool is associated with at least one of the user's assignments" do second_course = Course.create!(name: 'second course') - assignment.update_attributes!(course: second_course) + assignment.update!(course: second_course) get canvas_id_endpoint, params: {id: student.id}, headers: request_headers expect(response).to be_unauthorized end @@ -93,7 +93,7 @@ module Lti context 'course' do before do - tool_proxy.update_attributes!(context: course) + tool_proxy.update!(context: course) end it 'returns a user by lti id' do @@ -152,7 +152,7 @@ module Lti let(:student_one) do student_in_course(course: group.context) - @student.update_attributes!(lti_context_id: student_lti_id) + @student.update!(lti_context_id: student_lti_id) @student end @@ -163,12 +163,12 @@ module Lti let(:student_three) do student_in_course(course: group.context) - @student.update_attributes!(email: 'student@test.com') + @student.update!(email: 'student@test.com') @student end before do - group.context.update_attributes!(account: tool_proxy.account) + group.context.update!(account: tool_proxy.account) group.add_user(student_one, 'accepted') group.add_user(student_two, 'accepted') group.add_user(student_three, 'accepted') @@ -184,13 +184,13 @@ module Lti end it 'responds with 401 if group is not in tool context' do - group.context.update_attributes!(account: account_model) + group.context.update!(account: account_model) get group_index_endpoint, headers: request_headers expect(response).to be_unauthorized end it 'responds with 401 if the group is not active' do - group.update_attributes!(workflow_state: 'deleted') + group.update!(workflow_state: 'deleted') get group_index_endpoint, headers: request_headers expect(response).to be_unauthorized end diff --git a/spec/apis/v1/assignment_groups_api_spec.rb b/spec/apis/v1/assignment_groups_api_spec.rb index b3bb897047f..1478b3c41d0 100644 --- a/spec/apis/v1/assignment_groups_api_spec.rb +++ b/spec/apis/v1/assignment_groups_api_spec.rb @@ -965,7 +965,7 @@ describe AssignmentGroupsApiController, type: :request do Factories::GradingPeriodHelper.new.create_for_group(@grading_period_group, { start_date: 2.weeks.ago, end_date: 2.days.ago, close_date: 1.day.ago }) - @assignment_group.update_attributes(group_weight: 50) + @assignment_group.update(group_weight: 50) end context "as a teacher" do diff --git a/spec/apis/v1/assignment_overrides_spec.rb b/spec/apis/v1/assignment_overrides_spec.rb index 0afacd1cf77..0a6bb5d2c49 100644 --- a/spec/apis/v1/assignment_overrides_spec.rb +++ b/spec/apis/v1/assignment_overrides_spec.rb @@ -793,7 +793,7 @@ describe AssignmentOverridesController, type: :request do end it "recomputes grades when changing overrides" do - @assignment.update_attributes! only_visible_to_overrides: true, points_possible: 10 + @assignment.update! only_visible_to_overrides: true, points_possible: 10 other_assignment = @course.assignments.create! points_possible: 10, context: @course student1 = @student diff --git a/spec/apis/v1/assignments_api_spec.rb b/spec/apis/v1/assignments_api_spec.rb index 7395e7c81fe..1fb2bb3cd77 100644 --- a/spec/apis/v1/assignments_api_spec.rb +++ b/spec/apis/v1/assignments_api_spec.rb @@ -1757,7 +1757,7 @@ describe AssignmentsApiController, type: :request do let(:course) { Course.create!(name: 'test course', account: account) } let(:teacher) { teacher_in_course(course: course) } - before { account.update_attributes(root_account: root_account) } + before { account.update(root_account: root_account) } it "checks for tool installation in entire account chain" do user_session teacher @@ -1845,7 +1845,7 @@ describe AssignmentsApiController, type: :request do let(:context) { raise 'Override in spec' } it 'sets the tool correctly' do - tool_proxy.update_attributes(context: context) + tool_proxy.update(context: context) allow_any_instance_of(AssignmentConfigurationToolLookup).to receive(:create_subscription).and_return true Lti::ToolProxyBinding.create(context: context, tool_proxy: tool_proxy) api_create_assignment_in_course( diff --git a/spec/apis/v1/calendar_events_api_spec.rb b/spec/apis/v1/calendar_events_api_spec.rb index 8ce670e26a2..05693c53e27 100644 --- a/spec/apis/v1/calendar_events_api_spec.rb +++ b/spec/apis/v1/calendar_events_api_spec.rb @@ -53,7 +53,7 @@ describe CalendarEventsApiController, type: :request do it 'should hide location attributes when user is not logged in a public course' do @me = nil @user = nil - @course.update_attributes(:is_public => true, :indexed => true) + @course.update(:is_public => true, :indexed => true) @course.calendar_events.create( :title => '2', :start_at => '2012-01-08 12:00:00', @@ -69,7 +69,7 @@ describe CalendarEventsApiController, type: :request do end it 'should show location attributes when user logged in a public course' do - @course.update_attributes(:is_public => true, :indexed => true) + @course.update(:is_public => true, :indexed => true) evt = @course.calendar_events.create( :title => '2', :start_at => '2012-01-08 12:00:00', @@ -136,7 +136,7 @@ describe CalendarEventsApiController, type: :request do @e2 = @user.calendar_events.create!(:title => "today in AKST", :start_at => @akst.parse('2012-01-29 21:00:00')) { |c| c.context = @user } @e3 = @user.calendar_events.create!(:title => "tomorrow in AKST", :start_at => @akst.parse('2012-01-30 21:00:00')) { |c| c.context = @user } - @user.update_attributes! :time_zone => "Alaska" + @user.update! :time_zone => "Alaska" end it "shows today's events in user's timezone, even if UTC has crossed into tomorrow" do diff --git a/spec/apis/v1/conversations_api_spec.rb b/spec/apis/v1/conversations_api_spec.rb index 1832ade8e0b..52c6490b15c 100644 --- a/spec/apis/v1/conversations_api_spec.rb +++ b/spec/apis/v1/conversations_api_spec.rb @@ -26,7 +26,7 @@ describe ConversationsController, type: :request do course_with_teacher(:active_course => true, :active_enrollment => true, :user => user_with_pseudonym(:active_user => true)) @course.update_attribute(:name, "the course") @course.account.role_overrides.create!(permission: 'send_messages_all', role: teacher_role, enabled: false) - @course.default_section.update_attributes(:name => "the section") + @course.default_section.update(:name => "the section") @other_section = @course.course_sections.create(:name => "the other section") @me = @user diff --git a/spec/apis/v1/courses_api_spec.rb b/spec/apis/v1/courses_api_spec.rb index 2f8d535eef1..775cfdc0ac0 100644 --- a/spec/apis/v1/courses_api_spec.rb +++ b/spec/apis/v1/courses_api_spec.rb @@ -323,7 +323,7 @@ describe Api::V1::Course do it "should return blueprint restrictions by type" do template = MasterCourses::MasterTemplate.set_as_master_course(@course1) - template.update_attributes(:use_default_restrictions_by_type => true, + template.update(:use_default_restrictions_by_type => true, :default_restrictions_by_type => {"Assignment" => {:points => true}, "Quizzes::Quiz" => {:content => true}}) @@ -431,7 +431,7 @@ describe CoursesController, type: :request do course_with_student(:user => @user, :active_all => true) @course2 = @course @course2.update_attribute(:sis_source_id, 'TEST-SIS-ONE.2011') - @course2.update_attributes(:default_view => 'assignments') + @course2.update(:default_view => 'assignments') @user.pseudonym.update_attribute(:sis_user_id, 'user1') end @@ -1293,7 +1293,7 @@ describe CoursesController, type: :request do context "when an assignment is due in a closed grading period" do before(:once) do - @course.update_attributes(group_weighting_scheme: "equal") + @course.update(group_weighting_scheme: "equal") @grading_period_group = Factories::GradingPeriodGroupHelper.new.create_for_account(@course.root_account) term = @course.enrollment_term term.grading_period_group = @grading_period_group @@ -1435,7 +1435,7 @@ describe CoursesController, type: :request do context "when an assignment is due in a closed grading period" do before :once do - @course.update_attributes(group_weighting_scheme: "equal") + @course.update(group_weighting_scheme: "equal") @grading_period_group = Factories::GradingPeriodGroupHelper.new.create_for_account(@course.root_account) term = @course.enrollment_term term.grading_period_group = @grading_period_group @@ -3410,7 +3410,7 @@ describe CoursesController, type: :request do describe "#show" do it "should get individual course data" do - @course1.root_account.update_attributes(:default_time_zone => 'America/Los_Angeles') + @course1.root_account.update(:default_time_zone => 'America/Los_Angeles') json = api_call(:get, "/api/v1/courses/#{@course1.id}.json", { :controller => 'courses', :action => 'show', :id => @course1.to_param, :format => 'json' }) diff --git a/spec/apis/v1/discussion_topics_api_spec.rb b/spec/apis/v1/discussion_topics_api_spec.rb index a46855db369..5d2742ac105 100644 --- a/spec/apis/v1/discussion_topics_api_spec.rb +++ b/spec/apis/v1/discussion_topics_api_spec.rb @@ -780,7 +780,7 @@ describe DiscussionTopicsController, type: :request do end it "should properly translate a video media comment in the discussion topic's message" do - @topic.update_attributes( + @topic.update( message: '
' ) @@ -800,7 +800,7 @@ describe DiscussionTopicsController, type: :request do end it "should properly translate a audio media comment in the discussion topic's message" do - @topic.update_attributes( + @topic.update( message: '' ) @@ -2624,7 +2624,7 @@ describe DiscussionTopicsController, type: :request do @reply3.change_read_state("read", @user) # have the teacher edit one of the student's replies @reply_reply1.editor = @teacher - @reply_reply1.update_attributes(:message => 'censored
') + @reply_reply1.update(:message => 'censored
') @all_entries.each &:reload diff --git a/spec/apis/v1/enrollments_api_spec.rb b/spec/apis/v1/enrollments_api_spec.rb index 68461e125c2..206bf4ea830 100644 --- a/spec/apis/v1/enrollments_api_spec.rb +++ b/spec/apis/v1/enrollments_api_spec.rb @@ -736,7 +736,7 @@ describe EnrollmentsApiController, type: :request do end it "should not allow self-enrollment in a concluded course" do - @course.update_attributes(:start_at => 2.days.ago, :conclude_at => 1.day.ago, + @course.update(:start_at => 2.days.ago, :conclude_at => 1.day.ago, :restrict_enrollments_to_course_dates => true) json = raw_api_call :post, @path, @path_options, {enrollment: {user_id: 'self', self_enrollment_code: @course.self_enrollment_code}} diff --git a/spec/apis/v1/external_tools_api_spec.rb b/spec/apis/v1/external_tools_api_spec.rb index 0b99eaf13d6..d8df8615ba5 100644 --- a/spec/apis/v1/external_tools_api_spec.rb +++ b/spec/apis/v1/external_tools_api_spec.rb @@ -190,7 +190,7 @@ describe ExternalToolsController, type: :request do end it "returns sessionless launch URL when default URL is not set and placement URL is" do - tool.update_attributes!(url: nil) + tool.update!(url: nil) params = { id: tool.id.to_s, launch_type: 'course_navigation' } json = get_sessionless_launch_url(@course, 'course', params) expect(json).to include('url') diff --git a/spec/apis/v1/gradebook_history_api_spec.rb b/spec/apis/v1/gradebook_history_api_spec.rb index afadc7c815b..d0d99dfea8d 100644 --- a/spec/apis/v1/gradebook_history_api_spec.rb +++ b/spec/apis/v1/gradebook_history_api_spec.rb @@ -100,7 +100,7 @@ describe GradebookHistoryApiController, type: :request do it 'routes properly and returns reasonable data' do grader = user_with_pseudonym(:name => 'Grader', :username => 'grader@example.com', :active_all => 1) - @submission.update_attributes!(:graded_at => date, :grader_id => grader.id, :score => 100) + @submission.update!(:graded_at => date, :grader_id => grader.id, :score => 100) json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/#{date_str}/graders/#{grader.id}/assignments/#{@assignment.id}/submissions.json", @@ -118,7 +118,7 @@ describe GradebookHistoryApiController, type: :request do end it 'can find autograded data' do - @submission.update_attributes!(:graded_at => date, :grader_id => -50, :score => 100) + @submission.update!(:graded_at => date, :grader_id => -50, :score => 100) json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/#{date_str}/graders/0/assignments/#{@assignment.id}/submissions.json", @@ -162,13 +162,13 @@ describe GradebookHistoryApiController, type: :request do def create_versions @submission1.with_versioning(:explicit => true) { - @submission1.update_attributes!(:graded_at => Time.zone.now, :grader_id => @grader.id, :score => 100) } + @submission1.update!(:graded_at => Time.zone.now, :grader_id => @grader.id, :score => 100) } @submission2.with_versioning(:explicit => true) { - @submission2.update_attributes!(:graded_at => Time.zone.now, :grader_id => @super_grader.id, :score => 90) } + @submission2.update!(:graded_at => Time.zone.now, :grader_id => @super_grader.id, :score => 90) } @submission3.with_versioning(:explicit => true) { - @submission3.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) } + @submission3.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) } @submission4.with_versioning(:explicit => true) { - @submission4.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) } + @submission4.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) } end it 'should return all applicable versions' do @@ -210,7 +210,7 @@ describe GradebookHistoryApiController, type: :request do it 'should order the most recent versions first' do @submission3.with_versioning(:explicit => true) { - @submission3.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) + @submission3.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) } json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/feed.json", { @@ -227,7 +227,7 @@ describe GradebookHistoryApiController, type: :request do it 'should optionally restrict by assignment_id' do @submission4.with_versioning(:explicit => true) { - @submission4.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) + @submission4.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) } json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/feed.json?assignment_id=#{@assignment2.id}", { @@ -244,7 +244,7 @@ describe GradebookHistoryApiController, type: :request do it 'should optionally restrict by user_id' do @submission4.with_versioning(:explicit => true) { - @submission4.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) + @submission4.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 70) } json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/feed.json?user_id=#{@student1.id}", { @@ -261,7 +261,7 @@ describe GradebookHistoryApiController, type: :request do it 'should optionally reverse ordering to oldest version first' do @submission3.with_versioning(:explicit => true) { - @submission3.update_attributes!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) + @submission3.update!(:graded_at => 24.hours.ago, :grader_id => @other_grader.id, :score => 80) } json = api_call_as_user(@teacher, :get, "/api/v1/courses/#{@course.id}/gradebook_history/feed.json?ascending=1", { diff --git a/spec/apis/v1/gradebook_history_spec.rb b/spec/apis/v1/gradebook_history_spec.rb index fbdd28c6b6f..33cbe5b4666 100644 --- a/spec/apis/v1/gradebook_history_spec.rb +++ b/spec/apis/v1/gradebook_history_spec.rb @@ -161,7 +161,7 @@ describe Api::V1::GradebookHistory do let(:harness) { GradebookHistoryHarness.new } let(:submission) do s = assignment.submit_homework(student) - s.update_attributes(graded_at: now, score: 90, grade: '90', grader: grader) + s.update(graded_at: now, score: 90, grade: '90', grader: grader) s end let(:course) do @@ -188,7 +188,7 @@ describe Api::V1::GradebookHistory do @course.enroll_teacher(@grader2) @assignment = @course.assignments.create!(:title => "some assignment") @submission = @assignment.submit_homework(student1) - @submission.update_attributes(graded_at: now, grader_id: @grader1.id) + @submission.update(graded_at: now, grader_id: @grader1.id) @submission.score = 90 @submission.grade = '90' @submission.grader = @grader2 diff --git a/spec/apis/v1/master_courses/master_templates_api_spec.rb b/spec/apis/v1/master_courses/master_templates_api_spec.rb index 70a80922474..996cb402b73 100644 --- a/spec/apis/v1/master_courses/master_templates_api_spec.rb +++ b/spec/apis/v1/master_courses/master_templates_api_spec.rb @@ -76,7 +76,7 @@ describe MasterCourses::MasterTemplatesController, type: :request do term = Account.default.enrollment_terms.create!(:name => "termname") child_course1 = course_factory(:course_name => "immachildcourse1", :active_all => true) @teacher.update_attribute(:short_name, "displayname") - child_course1.update_attributes(:sis_source_id => "sisid", :course_code => "shortname", :enrollment_term => term) + child_course1.update(:sis_source_id => "sisid", :course_code => "shortname", :enrollment_term => term) child_course2 = course_factory(:course_name => "immachildcourse2") [child_course1, child_course2].each{|c| @template.add_child_course!(c)} @@ -372,7 +372,7 @@ describe MasterCourses::MasterTemplatesController, type: :request do assmt_restricts = {:content => true, :points => true} page_restricts = {:content => true} - @template.update_attributes(:use_default_restrictions_by_type => true, + @template.update(:use_default_restrictions_by_type => true, :default_restrictions_by_type => {'Assignment' => assmt_restricts, 'WikiPage' => page_restricts}) api_call(:put, @url, @params, {:content_type => 'assignment', :content_id => assmt.id, :restricted => '1'}, {}, {:expected_status => 200}) @@ -389,7 +389,7 @@ describe MasterCourses::MasterTemplatesController, type: :request do assmt_restricts = {:content => true, :points => true} quiz_restricts = {:content => true} - @template.update_attributes(:use_default_restrictions_by_type => true, + @template.update(:use_default_restrictions_by_type => true, :default_restrictions_by_type => {'Assignment' => assmt_restricts, 'Quizzes::Quiz' => quiz_restricts}) api_call(:put, @url, @params, {:content_type => 'assignment', :content_id => quiz_assmt.id, :restricted => '1'}, {}, {:expected_status => 200}) diff --git a/spec/apis/v1/search_api_spec.rb b/spec/apis/v1/search_api_spec.rb index a784ea0099f..953c702f9a5 100644 --- a/spec/apis/v1/search_api_spec.rb +++ b/spec/apis/v1/search_api_spec.rb @@ -24,7 +24,7 @@ describe SearchController, type: :request do @account = Account.default course_with_teacher(:active_course => true, :active_enrollment => true, :user => user_with_pseudonym(:active_user => true)) @course.update_attribute(:name, "the course") - @course.default_section.update_attributes(:name => "the section") + @course.default_section.update(:name => "the section") @other_section = @course.course_sections.create(:name => "the other section") @me = @user diff --git a/spec/apis/v1/stream_items_api_spec.rb b/spec/apis/v1/stream_items_api_spec.rb index 521df8b58d1..fc343ee5092 100644 --- a/spec/apis/v1/stream_items_api_spec.rb +++ b/spec/apis/v1/stream_items_api_spec.rb @@ -115,7 +115,7 @@ describe UsersController, type: :request do @course2.enroll_student(@student).accept! @dt1 = discussion_topic_model(:context => @course1) @dt2 = discussion_topic_model(:context => @course2) - @course2.update_attributes(:start_at => 2.weeks.ago, :conclude_at => 1.week.ago, :restrict_enrollments_to_course_dates => true) + @course2.update(:start_at => 2.weeks.ago, :conclude_at => 1.week.ago, :restrict_enrollments_to_course_dates => true) end json = api_call(:get, "/api/v1/users/self/activity_stream", { :controller => "users", :action => "activity_stream", :format => 'json' }) @@ -368,7 +368,7 @@ describe UsersController, type: :request do it "should format graded Submission with comments" do #set @domain_root_account @domain_root_account = Account.default - @domain_root_account.update_attributes(:default_time_zone => 'America/Denver') + @domain_root_account.update(:default_time_zone => 'America/Denver') @assignment = @course.assignments.create!(:title => 'assignment 1', :description => 'hai', :points_possible => '14.2', :submission_types => 'online_text_entry') @teacher = User.create!(:name => 'teacher') @@ -500,7 +500,7 @@ describe UsersController, type: :request do it "should format ungraded Submission with comments" do #set @domain_root_account @domain_root_account = Account.default - @domain_root_account.update_attributes(:default_time_zone => 'America/Denver') + @domain_root_account.update(:default_time_zone => 'America/Denver') @assignment = @course.assignments.create!(:title => 'assignment 1', :description => 'hai', :points_possible => '14.2', :submission_types => 'online_text_entry') @teacher = User.create!(:name => 'teacher') diff --git a/spec/apis/v1/submissions_api_spec.rb b/spec/apis/v1/submissions_api_spec.rb index a7c896a6571..db922e39ec0 100644 --- a/spec/apis/v1/submissions_api_spec.rb +++ b/spec/apis/v1/submissions_api_spec.rb @@ -4017,7 +4017,7 @@ describe 'Submissions API', type: :request do end it "creates a online text submission" do - @assignment.update_attributes(:submission_types => 'online_text_entry') + @assignment.update(:submission_types => 'online_text_entry') json = do_submit(:submission_type => 'online_text_entry', :body => %{This is some text. The sanitization will take effect.
}) @@ -4028,7 +4028,7 @@ describe 'Submissions API', type: :request do end it "processs html content in body" do - @assignment.update_attributes(:submission_types => 'online_text_entry') + @assignment.update(:submission_types => 'online_text_entry') should_process_incoming_user_content(@course) do |content| do_submit(:submission_type => 'online_text_entry', :body => content) @submission.body @@ -4036,7 +4036,7 @@ describe 'Submissions API', type: :request do end it "creates a file upload submission" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') a1 = attachment_model(:context => @user) a2 = attachment_model(:context => @user) json = do_submit(:submission_type => 'online_upload', :file_ids => [a1.id, a2.id]) @@ -4047,7 +4047,7 @@ describe 'Submissions API', type: :request do end it "creates a media comment submission" do - @assignment.update_attributes(:submission_types => "media_recording") + @assignment.update(:submission_types => "media_recording") media_object(:media_id => "3232", :media_type => "audio") json = do_submit(:submission_type => "media_recording", :media_comment_id => "3232", :media_comment_type => "audio") expect(json['media_comment'].slice('media_id', 'media_type')).to eq({ @@ -4057,7 +4057,7 @@ describe 'Submissions API', type: :request do end it "copys files to the submissions folder if they're not there already" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') a1 = attachment_model(:context => @user, :folder => @user.submissions_folder) a2 = attachment_model(:context => @user) json = do_submit(:submission_type => 'online_upload', :file_ids => [a1.id, a2.id]) @@ -4072,7 +4072,7 @@ describe 'Submissions API', type: :request do context "submission file uploads" do before :once do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') @student1 = @student course_with_student(:course => @course) @context = @course @@ -4127,19 +4127,19 @@ describe 'Submissions API', type: :request do end it "rejects uploading files when filetype is not allowed" do - @assignment.update_attributes(:allowed_extensions => ['doc']) + @assignment.update(:allowed_extensions => ['doc']) preflight(name: 'test.txt', size: 12345, content_type: 'text/plain') assert_status(400) end it "allows filetype when restricted and is correct filetype" do - @assignment.update_attributes(:allowed_extensions => ['txt']) + @assignment.update(:allowed_extensions => ['txt']) preflight(name: 'test.txt', size: 12345, content_type: 'text/plain') assert_status(200) end it "falls back to parsing the extension when an unknown type" do - @assignment.update_attributes(:allowed_extensions => ['beepboop']) + @assignment.update(:allowed_extensions => ['beepboop']) preflight(name: 'test.beepboop', size: 12345) assert_status(200) end @@ -4240,7 +4240,7 @@ describe 'Submissions API', type: :request do end it "rejects attachment ids not belonging to the user" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') a1 = attachment_model(:context => @course) json = api_call(:post, @url, @args, { :submission => { :submission_type => "online_upload", :file_ids => [a1.id] } }, {}, :expected_status => 400) expect(json['message']).to eq 'No valid file ids given' diff --git a/spec/apis/v1/terms_api_spec.rb b/spec/apis/v1/terms_api_spec.rb index 3b75467e573..b08e00624f6 100644 --- a/spec/apis/v1/terms_api_spec.rb +++ b/spec/apis/v1/terms_api_spec.rb @@ -94,8 +94,8 @@ describe TermsApiController, type: :request do describe "ordering" do it "should order by start_at first" do - @term1.update_attributes(start_at: 1.day.ago, end_at: 5.days.from_now) - @term2.update_attributes(start_at: 2.days.ago, end_at: 6.days.from_now) + @term1.update(start_at: 1.day.ago, end_at: 5.days.from_now) + @term2.update(start_at: 2.days.ago, end_at: 6.days.from_now) json = get_terms expect(json.first['name']).to eq @term1.name @@ -104,8 +104,8 @@ describe TermsApiController, type: :request do it "should order by end_at second" do start_at = 1.day.ago - @term1.update_attributes(start_at: start_at, end_at: 6.days.from_now) - @term2.update_attributes(start_at: start_at, end_at: 5.days.from_now) + @term1.update(start_at: start_at, end_at: 6.days.from_now) + @term2.update(start_at: start_at, end_at: 5.days.from_now) json = get_terms expect(json.first['name']).to eq @term1.name @@ -115,8 +115,8 @@ describe TermsApiController, type: :request do it "should order by id last" do start_at = 1.day.ago end_at = 5.days.from_now - @term1.update_attributes(start_at: start_at, end_at: end_at) - @term2.update_attributes(start_at: start_at, end_at: end_at) + @term1.update(start_at: start_at, end_at: end_at) + @term2.update(start_at: start_at, end_at: end_at) json = get_terms expect(json.first['name']).to eq @term1.name @@ -401,7 +401,7 @@ describe TermsController, type: :request do end it "allows removing sis_term_id with :manage_sis permission" do - @term1.update_attributes(sis_source_id: 'SIS Term 2') + @term1.update(sis_source_id: 'SIS Term 2') expect(@account.grants_right?(@user, :manage_sis)).to be_truthy json = api_call(:put, "/api/v1/accounts/#{@account.id}/terms/#{@term1.id}", { controller: 'terms', action: 'update', format: 'json', account_id: @account.to_param, id: @term1.to_param }, diff --git a/spec/apis/v1/todo_items_api_spec.rb b/spec/apis/v1/todo_items_api_spec.rb index 2ba062ddcb2..9c8be74a50a 100644 --- a/spec/apis/v1/todo_items_api_spec.rb +++ b/spec/apis/v1/todo_items_api_spec.rb @@ -136,7 +136,7 @@ describe UsersController, type: :request do end it 'should not crash when mixing items with/without due dates (users controller)' do - @a2.update_attributes(due_at: nil) + @a2.update(due_at: nil) api_call(:get, "/api/v1/users/self/todo", controller: "users", action: "todo_items", format: "json") expect(response).to be_successful @@ -144,7 +144,7 @@ describe UsersController, type: :request do it 'should not crash when mixing items with/without due dates (courses controller)' do @teacher_course.enroll_student(@teacher).accept! - @a2.update_attributes(due_at: nil) + @a2.update(due_at: nil) Assignment.create!(context: @teacher_course, due_at: 1.day.from_now, title: 'text', submission_types: 'online_text_entry', points_possible: 15) api_call(:get, "/api/v1/courses/#{@teacher_course.id}/todo", controller: "courses", action: "todo_items", diff --git a/spec/apis/v1/users_api_spec.rb b/spec/apis/v1/users_api_spec.rb index ce31dbf270d..3a4fa9d7c03 100644 --- a/spec/apis/v1/users_api_spec.rb +++ b/spec/apis/v1/users_api_spec.rb @@ -1692,13 +1692,13 @@ describe "Users API", type: :request do it "should be able to update a name without changing sortable name if sent together" do sortable = "Name, Sortable" - @student.update_attributes(:name => "Sortable Name", :sortable_name => sortable) + @student.update(:name => "Sortable Name", :sortable_name => sortable) api_call(:put, @path, @path_options, { :user => {:name => "Other Name", :sortable_name => sortable} }) expect(@student.reload.sortable_name).to eq sortable - @student.update_attributes(:name => "Sortable Name", :sortable_name => sortable) # reset + @student.update(:name => "Sortable Name", :sortable_name => sortable) # reset api_call(:put, @path, @path_options, {:user => {:name => "Other Name"}}) # only send in the name expect(@student.reload.sortable_name).to eq "Name, Other" # should auto sync end diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index e0c013f46bc..4d6cf237929 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -566,7 +566,7 @@ RSpec.describe ApplicationController do allow(content_tag).to receive(:id).and_return(42) allow(controller).to receive(:require_user) { user_model } allow(controller).to receive(:lti_launch_params) {{}} - content_tag.update_attributes!(context: assignment_model) + content_tag.update!(context: assignment_model) end context 'display_type == "full_width' do @@ -632,7 +632,7 @@ RSpec.describe ApplicationController do allow(controller).to receive(:require_user) { user_model } controller.instance_variable_set(:@current_user, user) controller.instance_variable_set(:@domain_root_account, course.account) - content_tag.update_attributes!(context: assignment_model) + content_tag.update!(context: assignment_model) end describe 'LTI 1.3' do @@ -651,7 +651,7 @@ RSpec.describe ApplicationController do tool.save! assignment = assignment_model(submission_types: 'external_tool', external_tool_tag: content_tag) - content_tag.update_attributes!(context: assignment) + content_tag.update!(context: assignment) end shared_examples_for 'a placement that caches the launch' do @@ -745,7 +745,7 @@ RSpec.describe ApplicationController do context 'return_url' do before do controller.instance_variable_set(:"@context", course) - content_tag.update_attributes!(context: assignment_model) + content_tag.update!(context: assignment_model) allow(content_tag.context).to receive(:quiz_lti?).and_return(true) allow(controller).to receive(:render) allow(controller).to receive(:lti_launch_params) diff --git a/spec/controllers/assignment_groups_controller_spec.rb b/spec/controllers/assignment_groups_controller_spec.rb index 19cf0c326b1..7361295c721 100644 --- a/spec/controllers/assignment_groups_controller_spec.rb +++ b/spec/controllers/assignment_groups_controller_spec.rb @@ -500,7 +500,7 @@ describe AssignmentGroupsController do Factories::GradingPeriodHelper.new.create_for_group(group, { start_date: 2.days.ago, end_date: 2.days.from_now, close_date: 3.days.from_now }) - @assignment1.update_attributes(due_at: 1.week.ago) + @assignment1.update(due_at: 1.week.ago) end it 'does not allow assignments in closed grading periods to be moved into different assignment groups' do diff --git a/spec/controllers/assignments_controller_spec.rb b/spec/controllers/assignments_controller_spec.rb index 6bc0907ced7..a2779d862f8 100644 --- a/spec/controllers/assignments_controller_spec.rb +++ b/spec/controllers/assignments_controller_spec.rb @@ -390,7 +390,7 @@ describe AssignmentsController do end before :each do - @assignment.update_attributes( + @assignment.update( moderated_grading: true, final_grader: @other_teacher, grader_count: 2 @@ -592,7 +592,7 @@ describe AssignmentsController do it "should assign 'similarity_pledge'" do pledge = 'I made this' - @course.account.update_attributes(turnitin_pledge: pledge) + @course.account.update(turnitin_pledge: pledge) get 'show', params: {:course_id => @course.id, :id => assignment.id} expect(assigns[:similarity_pledge]).to eq pledge end @@ -621,7 +621,7 @@ describe AssignmentsController do a = @course.assignments.create(:title => "some assignment") pledge = 'tii pledge' allow_any_instance_of(Assignment).to receive(:turnitin_enabled?).and_return(true) - @course.account.update_attributes(turnitin_pledge: pledge) + @course.account.update(turnitin_pledge: pledge) get 'show', params: {:course_id => @course.id, :id => a.id} expect(assigns[:similarity_pledge]).to eq pledge end @@ -1492,7 +1492,7 @@ describe AssignmentsController do allow_any_instance_of(AssignmentConfigurationToolLookup).to receive(:create_subscription).and_return true allow(Lti::ToolProxy).to receive(:find_active_proxies_for_context).with(@course) { Lti::ToolProxy.where(id: tool_proxy.id) } tool_proxy.resources << resource_handler - tool_proxy.update_attributes!(context: @course) + tool_proxy.update!(context: @course) AssignmentConfigurationToolLookup.create!( assignment: @assignment, diff --git a/spec/controllers/bookmarks/bookmarks_controller_spec.rb b/spec/controllers/bookmarks/bookmarks_controller_spec.rb index 3b43994782f..11ce673c6b0 100644 --- a/spec/controllers/bookmarks/bookmarks_controller_spec.rb +++ b/spec/controllers/bookmarks/bookmarks_controller_spec.rb @@ -47,7 +47,7 @@ describe Bookmarks::BookmarksController do end it "includes data" do - bookmark.update_attributes(data: {foo: "bar"}) + bookmark.update(data: {foo: "bar"}) get 'show', params: {id: bookmark.id}, format: 'json' json = json_parse expect(json["data"]["foo"]).to eq("bar") diff --git a/spec/controllers/communication_channels_controller_spec.rb b/spec/controllers/communication_channels_controller_spec.rb index eef7a93eb8b..9b37ba3fb3e 100644 --- a/spec/controllers/communication_channels_controller_spec.rb +++ b/spec/controllers/communication_channels_controller_spec.rb @@ -1256,7 +1256,7 @@ describe CommunicationChannelsController do it "should not re-send registration to a registered user when trying to re-send invitation for an unavailable course" do course_with_teacher_logged_in(active_all: true) - @course.update_attributes(:start_at => 1.week.from_now, :restrict_student_future_view => true, + @course.update(:start_at => 1.week.from_now, :restrict_student_future_view => true, :restrict_enrollments_to_course_dates => true) user_with_pseudonym(:active_all => true) # new user diff --git a/spec/controllers/conversations_controller_spec.rb b/spec/controllers/conversations_controller_spec.rb index 976abe42415..067410e4421 100644 --- a/spec/controllers/conversations_controller_spec.rb +++ b/spec/controllers/conversations_controller_spec.rb @@ -45,7 +45,7 @@ describe ConversationsController do conversation term = @course.root_account.enrollment_terms.create! :name => "Fall" - @course.update_attributes! :enrollment_term => term + @course.update! :enrollment_term => term get 'index' expect(response).to be_successful diff --git a/spec/controllers/courses_controller_spec.rb b/spec/controllers/courses_controller_spec.rb index 21525ad0c28..aa3506cfe92 100644 --- a/spec/controllers/courses_controller_spec.rb +++ b/spec/controllers/courses_controller_spec.rb @@ -129,7 +129,7 @@ describe CoursesController do inactive_enroll = @course.enroll_student(@student, :section => section2, :allow_multiple_enrollments => true) inactive_enroll.deactivate - @course.update_attributes(:start_at => 2.days.ago, :conclude_at => 1.day.ago, :restrict_enrollments_to_course_dates => true) + @course.update(:start_at => 2.days.ago, :conclude_at => 1.day.ago, :restrict_enrollments_to_course_dates => true) user_session(@student) @@ -206,13 +206,13 @@ describe CoursesController do # section date in past course1 = Account.default.courses.create! start_at: 2.months.ago, conclude_at: 1.month.from_now - course1.default_section.update_attributes(:end_at => 1.month.ago) + course1.default_section.update(:end_at => 1.month.ago) course1.offer! enrollment1 = course_with_student course: course1, user: @student, active_all: true # by section date, in future course2 = Account.default.courses.create! start_at: 2.months.ago, conclude_at: 1.month.ago - course2.default_section.update_attributes(:end_at => 1.month.from_now) + course2.default_section.update(:end_at => 1.month.from_now) course2.offer! enrollment2 = course_with_student course: course2, user: @student, active_all: true @@ -790,9 +790,9 @@ describe CoursesController do it "should accept an enrollment for a restricted by dates course" do course_with_student_logged_in(:active_all => true) - @course.update_attributes(:restrict_enrollments_to_course_dates => true, + @course.update(:restrict_enrollments_to_course_dates => true, :start_at => Time.now + 2.weeks) - @enrollment.update_attributes(:workflow_state => 'invited', last_activity_at: nil) + @enrollment.update(:workflow_state => 'invited', last_activity_at: nil) post 'enrollment_invitation', params: {:course_id => @course.id, :accept => '1', :invitation => @enrollment.uuid} diff --git a/spec/controllers/discussion_entries_controller_spec.rb b/spec/controllers/discussion_entries_controller_spec.rb index c3b95d4bf1d..f0bacbd0859 100644 --- a/spec/controllers/discussion_entries_controller_spec.rb +++ b/spec/controllers/discussion_entries_controller_spec.rb @@ -364,7 +364,7 @@ describe DiscussionEntriesController do end it 'respects podcast_has_student_posts for course discussions' do - @topic.update_attributes(podcast_enabled: true, podcast_has_student_posts: false) + @topic.update(podcast_enabled: true, podcast_has_student_posts: false) get 'public_feed', params: {:discussion_topic_id => @topic.id, :feed_code => @enrollment.feed_code}, :format => 'rss' expect(assigns[:discussion_entries].length).to eql 0 end @@ -375,7 +375,7 @@ describe DiscussionEntriesController do @topic = @group.discussion_topics.create(title: "group topic", user: @teacher) @entry = @topic.discussion_entries.create(message: "some message", user: @student) - @topic.update_attributes(podcast_enabled: true, podcast_has_student_posts: false) + @topic.update(podcast_enabled: true, podcast_has_student_posts: false) get 'public_feed', params: {:discussion_topic_id => @topic.id, :feed_code => membership.feed_code}, :format => 'rss' expect(assigns[:discussion_entries].length).to eql 1 end diff --git a/spec/controllers/discussion_topics_controller_spec.rb b/spec/controllers/discussion_topics_controller_spec.rb index f6531a3db93..d86971552c9 100644 --- a/spec/controllers/discussion_topics_controller_spec.rb +++ b/spec/controllers/discussion_topics_controller_spec.rb @@ -1006,7 +1006,7 @@ describe DiscussionTopicsController do it 'should remove a todo date from a topic' do user_session(@teacher) - @topic.update_attributes(todo_date: 1.day.from_now.in_time_zone('America/New_York')) + @topic.update(todo_date: 1.day.from_now.in_time_zone('America/New_York')) put 'update', params: {course_id: @course.id, topic_id: @topic.id, todo_date: nil}, format: 'json' expect(@topic.reload.todo_date).to be nil end @@ -1046,7 +1046,7 @@ describe DiscussionTopicsController do it 'should remove an existing todo date when changing a topic from ungraded to graded' do user_session(@teacher) - @topic.update_attributes(todo_date: 1.day.from_now) + @topic.update(todo_date: 1.day.from_now) put 'update', params: {course_id: @course.id, topic_id: @topic.id, assignment: {submission_types: ['discussion_topic'], name: 'Graded Topic 1'}}, format: 'json' expect(response.code).to eq '200' diff --git a/spec/controllers/external_tools_controller_spec.rb b/spec/controllers/external_tools_controller_spec.rb index a6cf5382997..b3fa0261fb1 100644 --- a/spec/controllers/external_tools_controller_spec.rb +++ b/spec/controllers/external_tools_controller_spec.rb @@ -1720,7 +1720,7 @@ describe ExternalToolsController do it 'redirects if there is no launch url associated with the tool' do no_url_tool = new_valid_tool(@course) - no_url_tool.update_attributes!(url: nil) + no_url_tool.update!(url: nil) params = {:course_id => @course.id, id: no_url_tool.id} expect(get :generate_sessionless_launch, params: params).to redirect_to course_url(@course) end diff --git a/spec/controllers/gradebook_history_api_controller_spec.rb b/spec/controllers/gradebook_history_api_controller_spec.rb index f5a818ee00b..88f7139d87e 100644 --- a/spec/controllers/gradebook_history_api_controller_spec.rb +++ b/spec/controllers/gradebook_history_api_controller_spec.rb @@ -49,10 +49,10 @@ describe GradebookHistoryApiController do @submission3 = @assignment1.submit_homework(student3) @submission4 = @assignment2.submit_homework(student) - @submission1.update_attributes!(:graded_at => Time.now, :grader_id => @grader.id, :score => 100) - @submission2.update_attributes!(:graded_at => Time.now, :grader_id => @super_grader.id, :score => 90) - @submission3.update_attributes!(:graded_at => (Time.now - 24.hours), :grader_id => @other_grader.id, :score => 80) - @submission4.update_attributes!(:graded_at => (Time.now - 24.hours), :grader_id => @other_grader.id, :score => 70) + @submission1.update!(:graded_at => Time.now, :grader_id => @grader.id, :score => 100) + @submission2.update!(:graded_at => Time.now, :grader_id => @super_grader.id, :score => 90) + @submission3.update!(:graded_at => (Time.now - 24.hours), :grader_id => @other_grader.id, :score => 80) + @submission4.update!(:graded_at => (Time.now - 24.hours), :grader_id => @other_grader.id, :score => 70) end before :each do diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 83327824ecc..d1a11cd1ae7 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -753,7 +753,7 @@ describe GroupsController do @group.add_user(@student2) @group.add_user(@student3) @student2.enrollments.first.deactivate - @student3.enrollments.first.update_attributes(:start_at => 1.day.from_now, :end_at => 2.days.from_now) # technically "inactive" but not really + @student3.enrollments.first.update(:start_at => 1.day.from_now, :end_at => 2.days.from_now) # technically "inactive" but not really end it "include active status if requested" do diff --git a/spec/controllers/lti/ims/line_items_controller_spec.rb b/spec/controllers/lti/ims/line_items_controller_spec.rb index 1f0bb6ca3bd..0c7644773c3 100644 --- a/spec/controllers/lti/ims/line_items_controller_spec.rb +++ b/spec/controllers/lti/ims/line_items_controller_spec.rb @@ -116,7 +116,7 @@ module Lti end it 'responds with 404 if course is concluded' do - course.update_attributes!(workflow_state: 'completed') + course.update!(workflow_state: 'completed') send_request expect(response).to be_not_found end @@ -321,7 +321,7 @@ module Lti context do let(:line_item_two) do li = line_item_model(resource_link: resource_link, assignment: assignment) - li.update_attributes!(created_at: line_item.created_at + 5.seconds) + li.update!(created_at: line_item.created_at + 5.seconds) li end let(:line_item_id) { line_item_two.id } @@ -341,7 +341,7 @@ module Lti let(:line_item) { assignment.line_items.first } it 'updates the assignment name if ResourceLink is absent' do - line_item.update_attributes!(resource_link: nil) + line_item.update!(resource_link: nil) send_request expect(line_item.reload.assignment.name).to eq new_label end diff --git a/spec/controllers/lti/message_controller_spec.rb b/spec/controllers/lti/message_controller_spec.rb index 9610165bf26..ed2873c8842 100644 --- a/spec/controllers/lti/message_controller_spec.rb +++ b/spec/controllers/lti/message_controller_spec.rb @@ -222,7 +222,7 @@ module Lti end before do - message_handler.update_attributes(message_type: MessageHandler::BASIC_LTI_LAUNCH_REQUEST) + message_handler.update(message_type: MessageHandler::BASIC_LTI_LAUNCH_REQUEST) resource_handler.message_handlers = [message_handler] resource_handler.save! lti_link.save! @@ -235,13 +235,13 @@ module Lti end it 'succeeds if the tool is installed in the current course' do - tool_proxy.update_attributes(context: course) + tool_proxy.update(context: course) get 'resource', params: {course_id: course.id, resource_link_id: link_id} expect(response).to be_ok end it "succeeds if the tool is installed in the current course's account" do - tool_proxy.update_attributes(context: account) + tool_proxy.update(context: account) get 'resource', params: {course_id: course.id, resource_link_id: link_id} expect(response).to be_ok end @@ -263,7 +263,7 @@ module Lti end it "responds with 400 if host name does not match" do - message_handler.update_attributes(launch_path: 'http://www.different.com') + message_handler.update(launch_path: 'http://www.different.com') get 'resource', params: {account_id: account.id, resource_link_id: link_id} expect(response).to be_bad_request end @@ -272,7 +272,7 @@ module Lti context 'assignment' do let(:assignment) {course.assignments.create!(name: 'test')} - before {tool_proxy.update_attributes(context: course)} + before {tool_proxy.update(context: course)} it 'finds the specified assignment' do get 'resource', params: {course_id: course.id, @@ -299,16 +299,16 @@ module Lti context 'search account chain' do let(:root_account) {Account.create!} - before {account.update_attributes(root_account: root_account)} + before {account.update(root_account: root_account)} it "succeeds if the tool is installed in the current account's root account" do - tool_proxy.update_attributes(context: root_account) + tool_proxy.update(context: root_account) get 'resource', params: {account_id: account.id, resource_link_id: link_id} expect(response).to be_ok end it "succeeds if the tool is installed in the current course's root account" do - tool_proxy.update_attributes(context: root_account) + tool_proxy.update(context: root_account) get 'resource', params: {course_id: course.id, resource_link_id: link_id} expect(response).to be_ok end diff --git a/spec/controllers/lti_api_controllers_spec.rb b/spec/controllers/lti_api_controllers_spec.rb index 441555de875..f7ba5005954 100644 --- a/spec/controllers/lti_api_controllers_spec.rb +++ b/spec/controllers/lti_api_controllers_spec.rb @@ -367,7 +367,7 @@ XML end it "should fail if assignment has no points possible" do - @assignment.update_attributes(:points_possible => nil, :grading_type => 'percent') + @assignment.update(:points_possible => nil, :grading_type => 'percent') make_call('body' => replace_result(score: '0.75', sourceid: nil)) expect(response).to be_successful xml = Nokogiri::XML.parse(response.body) @@ -376,7 +376,7 @@ XML end it "should pass if assignment has 0 points possible" do - @assignment.update_attributes(:points_possible => 0, :grading_type => 'percent') + @assignment.update(:points_possible => 0, :grading_type => 'percent') make_call('body' => replace_result(score: '0.75', sourceid: nil)) check_success @@ -390,7 +390,7 @@ XML it "should notify users if it fails because the assignment has no points" do - @assignment.update_attributes(:points_possible => nil, :grading_type => 'percent') + @assignment.update(:points_possible => nil, :grading_type => 'percent') make_call('body' => replace_result(score: '0.75', sourceid: nil)) expect(response).to be_successful submissions = @assignment.submissions.where(user_id: @student).to_a @@ -431,7 +431,7 @@ to because the assignment has no points possible. context "pass_fail zero point assignments" do it "should succeed with incomplete grade when score < 1" do - @assignment.update_attributes(:points_possible => 10, :grading_type => 'pass_fail') + @assignment.update(:points_possible => 10, :grading_type => 'pass_fail') make_call('body' => replace_result(score: '0.75', sourceid: nil)) check_success @@ -447,7 +447,7 @@ to because the assignment has no points possible. end it "should succeed with incomplete grade when score < 1 for a 0 point assignment" do - @assignment.update_attributes(:points_possible => 0, :grading_type => 'pass_fail') + @assignment.update(:points_possible => 0, :grading_type => 'pass_fail') make_call('body' => replace_result(score: '0.75', sourceid: nil)) check_success @@ -463,7 +463,7 @@ to because the assignment has no points possible. end it "should succeed with complete grade when score = 1" do - @assignment.update_attributes(:points_possible => 0, :grading_type => 'pass_fail') + @assignment.update(:points_possible => 0, :grading_type => 'pass_fail') make_call('body' => replace_result(score: '1', sourceid: nil)) check_success @@ -594,7 +594,7 @@ to because the assignment has no points possible. end it "should reject if the assignment is no longer a tool assignment" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') @assignment.reload.external_tool_tag.destroy_permanently! make_call('body' => replace_result(score: '0.5')) check_failure('failure', 'Assignment is no longer associated with this tool') @@ -806,7 +806,7 @@ to because the assignment has no points possible. end it "should reject if the assignment is no longer a tool assignment" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') @assignment.reload.external_tool_tag.destroy_permanently! make_call('body' => update_result('0.5')) check_failure diff --git a/spec/controllers/planner_controller_spec.rb b/spec/controllers/planner_controller_spec.rb index 91a1d57f45e..f3e095b2ec3 100644 --- a/spec/controllers/planner_controller_spec.rb +++ b/spec/controllers/planner_controller_spec.rb @@ -156,7 +156,7 @@ describe PlannerController do expect(event_ids).not_to include event.id expect(event_ids).to include my_event_id - event.update_attributes(remove_child_events: true) + event.update(remove_child_events: true) get :index json = json_parse(response.body) @@ -233,7 +233,7 @@ describe PlannerController do @current_user = @student reviewee = user_model differentiated_assignment(course: @course, peer_reviews: true, due_at: nil) - @override.update_attributes(due_at: Time.zone.now, due_at_overridden: true) + @override.update(due_at: Time.zone.now, due_at_overridden: true) add_section('section 2').enroll_user(reviewee, 'StudentEnrollment', 'active') create_section_override_for_assignment(@assignment, due_at: nil, course_section: @course_section) submission_model(assignment: @assignment, user: reviewee) diff --git a/spec/controllers/pseudonyms_controller_spec.rb b/spec/controllers/pseudonyms_controller_spec.rb index 43ebaa64fa5..8642e9fdfef 100644 --- a/spec/controllers/pseudonyms_controller_spec.rb +++ b/spec/controllers/pseudonyms_controller_spec.rb @@ -84,7 +84,7 @@ describe PseudonymsController do it "rejects an expired password-change token" do @cc.forgot_password! - @cc.update_attributes :confirmation_code_expires_at => 1.hour.ago + @cc.update :confirmation_code_expires_at => 1.hour.ago post 'change_password', :params => { :pseudonym_id => @pseudonym.id, :nonce => @cc.confirmation_code, :pseudonym => {:password => '12341234', :password_confirmation => '12341234'} } assert_status(400) end @@ -139,7 +139,7 @@ describe PseudonymsController do it "should not render confirm change password view for non-email channels" do @user.register - @cc.update_attributes(:path_type => 'sms') + @cc.update(:path_type => 'sms') get 'confirm_change_password', params: {:pseudonym_id => @pseudonym.id, :nonce => @cc.confirmation_code} expect(response).to be_redirect end @@ -151,7 +151,7 @@ describe PseudonymsController do it "should not render confirm change password view if token is expired" do @user.register - @cc.update_attributes :confirmation_code_expires_at => 1.hour.ago + @cc.update :confirmation_code_expires_at => 1.hour.ago get 'confirm_change_password', :params => { :pseudonym_id => @pseudonym.id, :nonce => @cc.confirmation_code } expect(response).to be_redirect end diff --git a/spec/controllers/quizzes/quizzes_controller_spec.rb b/spec/controllers/quizzes/quizzes_controller_spec.rb index a18ce038bec..0d4a0b31887 100644 --- a/spec/controllers/quizzes/quizzes_controller_spec.rb +++ b/spec/controllers/quizzes/quizzes_controller_spec.rb @@ -1698,7 +1698,7 @@ describe Quizzes::QuizzesController do # aka should handle the case where the quiz's assignment is nil/not present. user_session(@teacher) course_quiz - @quiz.update_attributes(quiz_type: 'survey') + @quiz.update(quiz_type: 'survey') # make sure the assignment doesn't exist @quiz.assignment = nil expect(@quiz.assignment).not_to be_present diff --git a/spec/controllers/rubric_assessments_controller_spec.rb b/spec/controllers/rubric_assessments_controller_spec.rb index 8047bf5928a..5199e0f482e 100644 --- a/spec/controllers/rubric_assessments_controller_spec.rb +++ b/spec/controllers/rubric_assessments_controller_spec.rb @@ -406,7 +406,7 @@ describe RubricAssessmentsController do @assignment.submit_homework(@student1, :url => "http://www.google.com") @assignment.submit_homework(@student2, :url => "http://www.google.com") @assignment.submit_homework(@student3, :url => "http://www.google.com") - @assignment.update_attributes(:peer_review_count => 2) + @assignment.update(:peer_review_count => 2) res = @assignment.assign_peer_reviews expect(res).not_to be_empty # two of the six possible combinations have already been created diff --git a/spec/controllers/rubrics_controller_spec.rb b/spec/controllers/rubrics_controller_spec.rb index a7f02b138b7..ad57176ba7f 100644 --- a/spec/controllers/rubrics_controller_spec.rb +++ b/spec/controllers/rubrics_controller_spec.rb @@ -294,7 +294,7 @@ describe RubricsController do course_with_teacher_logged_in(:active_all => true) rubric_association_model(:user => @user, :context => @course, :purpose => 'grading') - @rubric_association_object.update_attributes(:migration_id => "#{MasterCourses::MIGRATION_ID_PREFIX}_blah") + @rubric_association_object.update(:migration_id => "#{MasterCourses::MIGRATION_ID_PREFIX}_blah") mc_course = Course.create! @template = MasterCourses::MasterTemplate.set_as_master_course(mc_course) sub = @template.add_child_course!(@course) diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index fb67359fbf9..89ffdd67453 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -77,7 +77,7 @@ describe SearchController do @course2.enroll_student(@user).accept @course2.update_attribute(:name, "course2") term = @course2.root_account.enrollment_terms.create! :name => "Fall", :end_at => 1.day.ago - @course2.update_attributes! :enrollment_term => term + @course2.update! :enrollment_term => term get 'recipients', params: {search: 'course', :messageable_only => true} expect(response.body).to include('course1') expect(response.body).not_to include('course2') @@ -85,7 +85,7 @@ describe SearchController do it "should return an empty list when searching in a non-messageable context" do course_with_student_logged_in(:active_all => true) - @enrollment.update_attributes(workflow_state: 'deleted') + @enrollment.update(workflow_state: 'deleted') get 'recipients', params: {search: 'foo', :context => @course.asset_string} expect(response.body).to match /\[\]\z/ end diff --git a/spec/controllers/submissions_controller_spec.rb b/spec/controllers/submissions_controller_spec.rb index 142c0c52fd6..d4e8340f99b 100644 --- a/spec/controllers/submissions_controller_spec.rb +++ b/spec/controllers/submissions_controller_spec.rb @@ -782,7 +782,7 @@ describe SubmissionsController do it 'can use attempt number to find the report url for text entry submissions' do originality_report2 # Create immediately - originality_report.update_attributes!(attachment: nil) + originality_report.update!(attachment: nil) expect(submission2.id).to eq(submission.id) # submission2 is updated/reloaded with new version (last attempt number) expect(submission2.attempt).to be > submission.attempt get 'originality_report', params: { diff --git a/spec/factories/calendar_event_factory.rb b/spec/factories/calendar_event_factory.rb index 29c4adbc445..b7cff77d036 100644 --- a/spec/factories/calendar_event_factory.rb +++ b/spec/factories/calendar_event_factory.rb @@ -40,7 +40,7 @@ module Factories def appointment_model(opts={}) appointment_group = opts[:appointment_group] || appointment_group_model(:sub_context => opts.delete(:sub_context)) - appointment_group.update_attributes(:new_appointments => [[opts[:start_at] || Time.now.utc + 1.hour, opts[:end_at] || Time.now.utc + 1.hour]]) + appointment_group.update(:new_appointments => [[opts[:start_at] || Time.now.utc + 1.hour, opts[:end_at] || Time.now.utc + 1.hour]]) @appointment = appointment_group.new_appointments.first appointment_group.reload @appointment diff --git a/spec/factories/conversation_factory.rb b/spec/factories/conversation_factory.rb index 139c64af363..840ce0b4b11 100644 --- a/spec/factories/conversation_factory.rb +++ b/spec/factories/conversation_factory.rb @@ -27,7 +27,7 @@ module Factories @message = @conversation.add_message('test') end - @conversation.update_attributes(options.slice(:subscribed, :starred, :workflow_state, :user)) + @conversation.update(options.slice(:subscribed, :starred, :workflow_state, :user)) @conversation.reload end end diff --git a/spec/factories/course_factory.rb b/spec/factories/course_factory.rb index 897c5952a70..fc38f987469 100644 --- a/spec/factories/course_factory.rb +++ b/spec/factories/course_factory.rb @@ -124,7 +124,7 @@ module Factories submission_count.times do |s| assignment = @course.assignments.create!(:title => "test #{s} assignment") submission = assignment.submissions.find_by!(user: @student) - submission.update_attributes!(score: '5') if opts[:submission_points] + submission.update!(score: '5') if opts[:submission_points] end end diff --git a/spec/graphql/types/assignment_type_spec.rb b/spec/graphql/types/assignment_type_spec.rb index 58403aa32b2..3ca1d2b330d 100644 --- a/spec/graphql/types/assignment_type_spec.rb +++ b/spec/graphql/types/assignment_type_spec.rb @@ -80,7 +80,7 @@ describe Types::AssignmentType do assignment.grader_count = 1 assignment.final_grader_id = teacher.id assignment.save! - assignment.update_attributes final_grader_id: teacher.id + assignment.update final_grader_id: teacher.id expect(assignment_type.resolve("moderatedGrading { enabled }")).to eq assignment.moderated_grading expect(assignment_type.resolve("moderatedGrading { finalGrader { _id } }")).to eq teacher.id.to_s expect(assignment_type.resolve("moderatedGrading { gradersAnonymousToGraders }")).to eq assignment.graders_anonymous_to_graders @@ -119,7 +119,7 @@ describe Types::AssignmentType do context "description" do before do - assignment.update_attributes description: %|Hione
", 'answer_weight' => '0'}]}) q.generate_quiz_data q.save diff --git a/spec/models/quizzes/quiz_submission_spec.rb b/spec/models/quizzes/quiz_submission_spec.rb index 53d5372e45e..f2ae47ee972 100644 --- a/spec/models/quizzes/quiz_submission_spec.rb +++ b/spec/models/quizzes/quiz_submission_spec.rb @@ -166,7 +166,7 @@ describe Quizzes::QuizSubmission do context 'on a graded_survey' do it "should award all points for a graded_survey" do - @quiz.update_attributes(points_possible: 42, quiz_type: 'graded_survey') + @quiz.update(points_possible: 42, quiz_type: 'graded_survey') qs = @quiz.generate_submission(@student) qs.submission_data = { "question_1" => "wrong" } @@ -500,19 +500,19 @@ describe Quizzes::QuizSubmission do expect(s.version_number).to eql(2) expect(s.kept_score).to eql(4.0) - q.update_attributes!(:scoring_policy => "keep_highest") + q.update!(:scoring_policy => "keep_highest") s.reload s.score = 3.0 s.attempt = 3 s.with_versioning(true, &:save!) expect(s.kept_score).to eql(5.0) - q.update_attributes!(scoring_policy: "keep_average") + q.update!(scoring_policy: "keep_average") s.reload s.with_versioning(true, &:save!) expect(s.kept_score).to eql(4.0) - q.update_attributes!(:scoring_policy => "keep_highest") + q.update!(:scoring_policy => "keep_highest") s.update_scores(:submission_version_number => 2, :fudge_points => 6.0) expect(s.kept_score).to eql(6.0) end @@ -1437,7 +1437,7 @@ describe Quizzes::QuizSubmission do submission_data = { 'question_1' => 'Hello' } survey_with_submission(questions) { submission_data } teacher_in_course(course: @course, active_all: true) - @quiz.update_attributes(points_possible: 15, quiz_type: 'graded_survey') + @quiz.update(points_possible: 15, quiz_type: 'graded_survey') Quizzes::SubmissionGrader.new(@quiz_submission.reload).grade_submission expect(@quiz_submission).to be_completed diff --git a/spec/models/sis_batch_spec.rb b/spec/models/sis_batch_spec.rb index 3e806edfe9a..1431a0c1c28 100644 --- a/spec/models/sis_batch_spec.rb +++ b/spec/models/sis_batch_spec.rb @@ -58,7 +58,7 @@ describe SisBatch do def process_csv_data(data, opts = {}) create_csv_data(data) do |batch| - batch.update_attributes(opts) if opts.present? + batch.update(opts) if opts.present? batch.process_without_send_later run_jobs batch.reload @@ -574,7 +574,7 @@ s2,test_1,section2,active}, batch = create_csv_data([%{user_id,login_id,status user_1,user_1,active}]) - batch.update_attributes(batch_mode: true, batch_mode_term: @term) + batch.update(batch_mode: true, batch_mode_term: @term) expect_any_instantiation_of(batch).to receive(:remove_previous_imports).once expect_any_instantiation_of(batch).to receive(:non_batch_courses_scope).never batch.process_without_send_later @@ -774,10 +774,10 @@ s2,test_1,section2,active}, it 'should not fail for empty diff file' do batch0 = create_csv_data([%{user_id,login_id,status}], add_empty_file: true) - batch0.update_attributes(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) + batch0.update(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) batch0.process_without_send_later batch1 = create_csv_data([%{user_id,login_id,status}], add_empty_file: true) - batch1.update_attributes(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) + batch1.update(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) batch1.process_without_send_later zip = Zip::File.open(batch1.generated_diff.open.path) @@ -787,10 +787,10 @@ s2,test_1,section2,active}, it 'should not fail for completely empty files' do batch0 = create_csv_data([], add_empty_file: true) - batch0.update_attributes(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) + batch0.update(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) batch0.process_without_send_later batch1 = create_csv_data([], add_empty_file: true) - batch1.update_attributes(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) + batch1.update(diffing_data_set_identifier: 'default', options: {diffing_drop_status: 'completed'}) batch1.process_without_send_later expect(batch1.reload).to be_imported end diff --git a/spec/models/speed_grader/assignment_spec.rb b/spec/models/speed_grader/assignment_spec.rb index 20b77973613..45f2a1f8102 100644 --- a/spec/models/speed_grader/assignment_spec.rb +++ b/spec/models/speed_grader/assignment_spec.rb @@ -574,7 +574,7 @@ describe SpeedGrader::Assignment do it 'does not include concluded students when user preference is to not include' do Enrollment.find_by(user: @student1).conclude - @course.update_attributes!(conclude_at: 1.day.ago, start_at: 2.days.ago) + @course.update!(conclude_at: 1.day.ago, start_at: 2.days.ago) json = SpeedGrader::Assignment.new(@assignment, @teacher).json expect(json[:context][:students].count).to be 1 end @@ -582,7 +582,7 @@ describe SpeedGrader::Assignment do it 'includes concluded when user preference is to include' do @teacher.preferences[:gradebook_settings][@course.id]['show_concluded_enrollments'] = 'true' Enrollment.find_by(user: @student1).conclude - @course.update_attributes!(conclude_at: 1.day.ago, start_at: 2.days.ago) + @course.update!(conclude_at: 1.day.ago, start_at: 2.days.ago) json = SpeedGrader::Assignment.new(@assignment, @teacher).json expect(json[:context][:students].count).to be 2 end @@ -1586,17 +1586,17 @@ describe SpeedGrader::Assignment do it "includes 'has_originality_report' in the json for group assignments" do user_two = test_student.dup - user_two.update_attributes!(lti_context_id: SecureRandom.uuid) + user_two.update!(lti_context_id: SecureRandom.uuid) assignment.course.enroll_student(user_two) group = group_model(context: assignment.course) - group.update_attributes!(users: [user_two, test_student]) + group.update!(users: [user_two, test_student]) submission = assignment.submit_homework(test_student, submission_type: 'online_upload', attachments: [attachment]) assignment.submit_homework(user_two, submission_type: 'online_upload', attachments: [attachment]) assignment.submissions.each do |s| - s.update_attributes!(group: group, turnitin_data: {blah: 1}) + s.update!(group: group, turnitin_data: {blah: 1}) end report = OriginalityReport.create!(originality_score: '1', submission: submission, attachment: attachment) diff --git a/spec/models/submission_comment_spec.rb b/spec/models/submission_comment_spec.rb index 7182ca7a8b2..5ec0f5c63b0 100644 --- a/spec/models/submission_comment_spec.rb +++ b/spec/models/submission_comment_spec.rb @@ -182,7 +182,7 @@ RSpec.describe SubmissionComment do @comment = @submission.submission_comments.create!(valid_attributes) expect(a.recently_created).to eql(true) @comment.reload - @comment.update_attributes(:attachments => [a]) + @comment.update(:attachments => [a]) expect(@comment.attachment_ids).to eql(a.id.to_s) end @@ -190,7 +190,7 @@ RSpec.describe SubmissionComment do a = Attachment.create!(:context => @assignment, :uploaded_data => default_uploaded_data) a.recently_created = false @comment = @submission.submission_comments.create!(valid_attributes) - @comment.update_attributes(:attachments => [a]) + @comment.update(:attachments => [a]) expect(@comment.attachment_ids).to eql("") end @@ -244,7 +244,7 @@ This text has a http://www.google.com link in it... frd_comment = @submission.add_comment(:author => @teacher, :comment => "some comment") expect(@submission.reload.last_comment_at.to_i).to eq frd_comment.created_at.to_i - draft_comment.update_attributes(:draft => false, :created_at => 2.days.from_now) # should re-run after update + draft_comment.update(:draft => false, :created_at => 2.days.from_now) # should re-run after update expect(@submission.reload.last_comment_at.to_i).to eq draft_comment.created_at.to_i draft_comment.destroy # should re-run after destroy diff --git a/spec/models/submission_spec.rb b/spec/models/submission_spec.rb index aa7ae2c40e4..95536bc2534 100644 --- a/spec/models/submission_spec.rb +++ b/spec/models/submission_spec.rb @@ -1491,7 +1491,7 @@ describe Submission do it "should send the correct message when an assignment is turned in on-time" do @assignment.workflow_state = "published" - @assignment.update_attributes(:due_at => Time.now + 1000) + @assignment.update(:due_at => Time.now + 1000) submission_spec_model(user: @student, submit_homework: true) expect(@submission.messages_sent.keys).to eq ['Assignment Submitted'] @@ -1509,12 +1509,12 @@ describe Submission do @course.enroll_user(normal_ta, "TaEnrollment", :enrollment_state => "active") n = Notification.where(:name => 'Assignment Submitted').first - n.update_attributes(:category => "TestImmediately") + n.update(:category => "TestImmediately") [limited_ta, normal_ta].each do |ta| NotificationPolicy.create(:notification => n, :communication_channel => ta.communication_channel, :frequency => "immediately") end @assignment.workflow_state = "published" - @assignment.update_attributes(:due_at => Time.now + 1000) + @assignment.update(:due_at => Time.now + 1000) submission_spec_model(user: @student, submit_homework: true) expect(@submission.messages_sent['Assignment Submitted'].map(&:user)).to eq [normal_ta] @@ -1523,7 +1523,7 @@ describe Submission do it "should send the correct message when an assignment is turned in late" do @assignment.workflow_state = "published" - @assignment.update_attributes(:due_at => Time.now - 1000) + @assignment.update(:due_at => Time.now - 1000) submission_spec_model(user: @student, submit_homework: true) expect(@submission.messages_sent.keys).to eq ['Assignment Submitted Late'] @@ -2241,7 +2241,7 @@ describe Submission do let(:originality_report) do AttachmentAssociation.create!(context: submission, attachment_id: attachment) - submission.update_attributes(attachment_ids: attachment.id.to_s) + submission.update(attachment_ids: attachment.id.to_s) OriginalityReport.create!(attachment: attachment, originality_score: '1', submission: submission) end @@ -2262,7 +2262,7 @@ describe Submission do it "prioritizes recent originality report if multiple exist for an attachment" do AttachmentAssociation.create!(context: submission, attachment_id: attachment) - submission.update_attributes(attachment_ids: attachment.id.to_s) + submission.update(attachment_ids: attachment.id.to_s) first_report = OriginalityReport.create!( attachment: attachment, submission: submission, @@ -2313,7 +2313,7 @@ describe Submission do end it 'does not cause error if originality score is nil' do - originality_report.update_attributes(originality_score: nil) + originality_report.update(originality_score: nil) expect{submission.originality_data}.not_to raise_error end @@ -2338,8 +2338,8 @@ describe Submission do end it "finds originality data text entry submissions" do - submission.update_attributes!(attachment_ids: attachment.id.to_s) - originality_report.update_attributes!(attachment: nil) + submission.update!(attachment_ids: attachment.id.to_s) + originality_report.update!(attachment: nil) expect(submission.originality_data).to eq({ OriginalityReport.submission_asset_key(submission) => { similarity_score: originality_report.originality_score, @@ -2378,7 +2378,7 @@ describe Submission do it "includes attachment ids from 'attachment_id'" do submission = @assignment.submit_homework(@student, submission_type: 'online_upload', attachments: attachments) - submission.update_attributes!(attachment_id: single_attachment) + submission.update!(attachment_id: single_attachment) expect(submission.attachment_ids_for_version).to match_array attachments.map(&:id) + [single_attachment.id] end end @@ -2419,11 +2419,11 @@ describe Submission do it 'returns true for group reports' do user_two = test_student.dup - user_two.update_attributes!(lti_context_id: SecureRandom.uuid) + user_two.update!(lti_context_id: SecureRandom.uuid) assignment.course.enroll_student(user_two) group = group_model(context: assignment.course) - group.update_attributes!(users: [user_two, test_student]) + group.update!(users: [user_two, test_student]) submission = assignment.submit_homework(test_student, submission_type: 'online_upload', attachments: [attachment]) submission_two = assignment.submit_homework(user_two, submission_type: 'online_upload', attachments: [attachment]) @@ -2432,7 +2432,7 @@ describe Submission do submission_two.update!(group: group) assignment.submissions.each do |s| - s.update_attributes!(group: group, turnitin_data: {blah: 1}) + s.update!(group: group, turnitin_data: {blah: 1}) end report = OriginalityReport.create!(originality_score: '1', submission: submission, attachment: attachment) @@ -2483,7 +2483,7 @@ describe Submission do end it 'returns the report url for text entry submission reports' do - originality_report.update_attributes!(attachment: nil) + originality_report.update!(attachment: nil) expect(submission.originality_report_url(submission.asset_string, test_teacher)).to eq report_url end @@ -2499,7 +2499,7 @@ describe Submission do it 'can use attempt number to find the report url for text entry submissions' do originality_report2 - originality_report.update_attributes!(attachment: nil) + originality_report.update!(attachment: nil) expect(submission2.attempt).to be > submission.attempt expect(submission.originality_report_url(submission.asset_string, test_teacher, submission.attempt.to_s)).to eq report_url expect(submission.originality_report_url(submission.asset_string, test_teacher, submission2.attempt.to_s)).to eq report_url2 @@ -3398,20 +3398,20 @@ describe Submission do end it 'excludes submission when it is excused and late_policy_status is missing' do - @submission.update_attributes(excused: true, late_policy_status: 'missing') + @submission.update(excused: true, late_policy_status: 'missing') expect(Submission.missing).to be_empty end it 'includes submission when late_policy_status is missing and assignment does not expect a submission' do - @submission.update_attributes(late_policy_status: 'missing') + @submission.update(late_policy_status: 'missing') @submission.assignment.update(submission_types: 'none') expect(Submission.missing).to include @submission end it 'excludes submission when due date has not passed' do - @submission.update_attributes(cached_due_date: 1.day.from_now(@now)) + @submission.update(cached_due_date: 1.day.from_now(@now)) expect(Submission.missing).to be_empty end @@ -3646,7 +3646,7 @@ describe Submission do group = group_category.groups.create!(name: "A Team", context: @course) group.add_user(student1) group.add_user(student2) - assignment.update_attributes(group_category: group_category) + assignment.update(group_category: group_category) user_attachment = attachment_model(context: student1) assignment.submit_homework(student1, submission_type: "online_upload", attachments: [user_attachment]) @@ -6546,7 +6546,7 @@ describe Submission do end def setup_account_for_turnitin(account) - account.update_attributes(turnitin_account_id: 'test_account', + account.update(turnitin_account_id: 'test_account', turnitin_shared_secret: 'skeret', settings: account.settings.merge(enable_turnitin: true)) end diff --git a/spec/models/user_learning_object_scopes_spec.rb b/spec/models/user_learning_object_scopes_spec.rb index 9c7e876baa8..0668162bad7 100644 --- a/spec/models/user_learning_object_scopes_spec.rb +++ b/spec/models/user_learning_object_scopes_spec.rb @@ -542,7 +542,7 @@ describe UserLearningObjectScopes do end it "should not include assessment requests for users not assigned the assignment" do - @assignment.update_attributes(only_visible_to_overrides: true) + @assignment.update(only_visible_to_overrides: true) # create a new section with only the reviewer student # since the reviewee is no longer assigned @assignment, the reviewer should # have nothing to do. @@ -653,14 +653,14 @@ describe UserLearningObjectScopes do end it "should not count submissions for users with a deleted enrollment in the graders's section" do - @course1.enroll_student(@student_b, allow_multiple_enrollments: true).update_attributes(workflow_state: 'deleted') + @course1.enroll_student(@student_b, allow_multiple_enrollments: true).update(workflow_state: 'deleted') assignment = @course1.assignments.first assignment.grade_student(@student_a, grade: "1", grader: @teacher) expect(@ta.assignments_needing_grading(scope_only: true)).not_to include assignment end it 'should not count submissions for sections where the grader has a deleted enrollment' do - @course1.enroll_user(@ta, 'TaEnrollment', allow_multiple_enrollments: true, section: @section1b).update_attributes(workflow_state: 'deleted') + @course1.enroll_user(@ta, 'TaEnrollment', allow_multiple_enrollments: true, section: @section1b).update(workflow_state: 'deleted') assignment = @course1.assignments.first assignment.grade_student(@student_a, grade: "1", grader: @teacher) expect(@ta.assignments_needing_grading(scope_only: true)).not_to include assignment @@ -771,7 +771,7 @@ describe UserLearningObjectScopes do @sectionb = @course.course_sections.create!(name: 'section B') @student_a = user_with_pseudonym(active_all: true, name: 'StudentA', username: 'studentA@instructure.com') @student_b = user_with_pseudonym(active_all: true, name: 'StudentB', username: 'studentB@instructure.com') - @course.enroll_student(@student_a).update_attributes(workflow_state: 'active') + @course.enroll_student(@student_a).update(workflow_state: 'active') @sectionb.enroll_user(@student_b, 'StudentEnrollment', 'active') end @@ -785,7 +785,7 @@ describe UserLearningObjectScopes do end it 'should not show counts for submissions that a grader can\'t see due to enrollment visibility' do - @enrollment.update_attributes(limit_privileges_to_course_section: true) # limit the teacher to only see one of the students + @enrollment.update(limit_privileges_to_course_section: true) # limit the teacher to only see one of the students assignment_model(course: @course, submission_types: ['online_text_entry']) [@student_a, @student_b].each do |student| @assignment.submit_homework student, body: "submission for #{student.name}" @@ -795,7 +795,7 @@ describe UserLearningObjectScopes do end it 'should not show counts for submissions in a section where the grader is enrolled but is not a grader' do - @enrollment.update_attributes(limit_privileges_to_course_section: true) + @enrollment.update(limit_privileges_to_course_section: true) @sectionb.enroll_user(@teacher, 'StudentEnrollment', 'active') assignment_model(course: @course, submission_types: ['online_text_entry']) [@student_a, @student_b].each do |student| diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 441d0d026c9..5d8301633bf 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -29,7 +29,7 @@ describe WikiPage do p.notify_of_update = true p.save! expect(p.created_at).to be <= 3.days.ago - p.update_attributes(:body => "Awgawg") + p.update(:body => "Awgawg") expect(p.messages_sent).not_to be_nil expect(p.messages_sent).not_to be_empty expect(p.messages_sent["Updated Wiki Page"]).not_to be_nil @@ -45,7 +45,7 @@ describe WikiPage do p.created_at = 3.days.ago p.notify_of_update = true p.save! - p.update_attributes(:body => "Awgawg") + p.update(:body => "Awgawg") expect(p.messages_sent["Updated Wiki Page"].map(&:user)).to be_include(@student) end @@ -53,12 +53,12 @@ describe WikiPage do course_with_student(:active_all => true) n = Notification.create(:name => "Updated Wiki Page", :category => "TestImmediately") NotificationPolicy.create(:notification => n, :communication_channel => @user.communication_channel, :frequency => "immediately") - @course.update_attributes(:start_at => 2.days.from_now, :restrict_enrollments_to_course_dates => true) + @course.update(:start_at => 2.days.from_now, :restrict_enrollments_to_course_dates => true) p = @course.wiki_pages.create(:title => "some page") p.created_at = 3.days.ago p.notify_of_update = true p.save! - p.update_attributes(:body => "Awgawg") + p.update(:body => "Awgawg") expect(p.messages_sent["Updated Wiki Page"].map(&:user)).to_not be_include(@student) end diff --git a/spec/presenters/grade_summary_assignment_presenter_spec.rb b/spec/presenters/grade_summary_assignment_presenter_spec.rb index 3cdb70bb9c7..d363322e2ee 100644 --- a/spec/presenters/grade_summary_assignment_presenter_spec.rb +++ b/spec/presenters/grade_summary_assignment_presenter_spec.rb @@ -62,7 +62,7 @@ describe GradeSummaryAssignmentPresenter do it 'returns when submission was automatically created by group assignment submission' do submission_two = @submission.dup - submission_two.update_attributes!(user: User.create!(name: 'second student')) + submission_two.update!(user: User.create!(name: 'second student')) AttachmentAssociation.create!(context: @submission, attachment_id: @attachment) AttachmentAssociation.create!(context: submission_two, attachment_id: @attachment) OriginalityReport.create(originality_score: 0.8, diff --git a/spec/selenium/admin/duplications/discussion_duplications_spec.rb b/spec/selenium/admin/duplications/discussion_duplications_spec.rb index 214d31acd72..4e9fd1ebcf6 100644 --- a/spec/selenium/admin/duplications/discussion_duplications_spec.rb +++ b/spec/selenium/admin/duplications/discussion_duplications_spec.rb @@ -53,7 +53,7 @@ describe "duplicate discussion" do before :once do course_with_teacher(:active_all => true) student_in_course(:active_all => true) - @course.update_attributes(:allow_student_discussion_editing => true, + @course.update(:allow_student_discussion_editing => true, :allow_student_discussion_topics=>true) @group_category = @course.group_categories.create!(:name => "Group Category") @group = @course.groups.create!(:group_category => @group_category, :name => "Group 1") diff --git a/spec/selenium/announcements/announcements_student_spec.rb b/spec/selenium/announcements/announcements_student_spec.rb index 65bcb6eaa8f..bb11d75e17b 100644 --- a/spec/selenium/announcements/announcements_student_spec.rb +++ b/spec/selenium/announcements/announcements_student_spec.rb @@ -80,7 +80,7 @@ describe "announcements" do get "/courses/#{@course.id}/announcements" expect(f("#content")).not_to contain_css(".ic-announcement-row") - announcement.update_attributes(:delayed_post_at => nil) + announcement.update(:delayed_post_at => nil) announcement.reload refresh_page # in order to see the announcement expect(f(".ic-announcement-row h3")).to include_text(announcement_title) diff --git a/spec/selenium/announcements/announcements_teacher_spec.rb b/spec/selenium/announcements/announcements_teacher_spec.rb index eea9eb700cb..7b39203f0f8 100644 --- a/spec/selenium/announcements/announcements_teacher_spec.rb +++ b/spec/selenium/announcements/announcements_teacher_spec.rb @@ -132,7 +132,7 @@ describe "announcements" do it "should add an attachment to a graded topic", priority: "1", test_id: 220367 do what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => 'graded attachment topic', :user => @user) : announcement_model(:title => 'graded attachment topic', :user => @user) if what_to_create == DiscussionTopic - what_to_create.last.update_attributes(:assignment => @course.assignments.create!(:name => 'graded topic assignment')) + what_to_create.last.update(:assignment => @course.assignments.create!(:name => 'graded topic assignment')) end get url expect_new_page_load { f('.ic-announcement-row h3').click } diff --git a/spec/selenium/announcements/rcs/announcements_teacher_spec.rb b/spec/selenium/announcements/rcs/announcements_teacher_spec.rb index d95ea9f20be..3cd51a49396 100644 --- a/spec/selenium/announcements/rcs/announcements_teacher_spec.rb +++ b/spec/selenium/announcements/rcs/announcements_teacher_spec.rb @@ -76,7 +76,7 @@ describe "announcements" do it "should add an attachment to a graded topic", priority: "1", test_id: 220367 do # no what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => 'graded attachment topic', :user => @user) : announcement_model(:title => 'graded attachment topic', :user => @user) if what_to_create == DiscussionTopic - what_to_create.last.update_attributes(:assignment => @course.assignments.create!(:name => 'graded topic assignment')) + what_to_create.last.update(:assignment => @course.assignments.create!(:name => 'graded topic assignment')) end get url expect_new_page_load { f('.ic-announcement-row h3').click } diff --git a/spec/selenium/assignments/assignment_allowed_attempts_spec.rb b/spec/selenium/assignments/assignment_allowed_attempts_spec.rb index ae24166757f..784cdb3954b 100644 --- a/spec/selenium/assignments/assignment_allowed_attempts_spec.rb +++ b/spec/selenium/assignments/assignment_allowed_attempts_spec.rb @@ -36,7 +36,7 @@ describe "allowed_attempts feature for assignments" do it "prevents submitting if the student has exceeded the max number of attempts" do submission = @assignment.submit_homework(@student, { body: "blah" }) - submission.update_attributes(attempt: 2, submission_type: "online_text_entry") + submission.update(attempt: 2, submission_type: "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" expect(f(".student-assignment-overview")).to include_text("Allowed Attempts") expect(f('.submit_assignment_link')).to be_disabled @@ -70,11 +70,11 @@ describe "allowed_attempts feature for assignments" do @assignment = @course.assignments.create!({ name: "Test Assignment", allowed_attempts: 2 }) @assignment.update_attribute(:submission_types, "online_text_entry") @submission = @assignment.submit_homework(@student, { body: "blah" }) - @submission.update_attributes(submission_type: "online_text_entry") + @submission.update(submission_type: "online_text_entry") end it "prevents submitting if the student has exceeded the max number of attempts" do - @submission.update_attributes(attempt: 2) + @submission.update(attempt: 2) get "/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}" expect(f(".submission-details-header__info")).to include_text("Allowed Attempts") expect(fln("Re-submit Assignment")).to be_disabled @@ -92,7 +92,7 @@ describe "allowed_attempts feature for assignments" do @assignment = @course.assignments.create!({ name: "Test Assignment", allowed_attempts: -1 }) @assignment.update_attribute(:submission_types, "online_text_entry") @submission = @assignment.submit_homework(@student, { body: "blah" }) - @submission.update_attributes(attempt: 2, submission_type: "online_text_entry") + @submission.update(attempt: 2, submission_type: "online_text_entry") end it "does not show the attempt data and allows submitting" do diff --git a/spec/selenium/assignments/assignments_spec.rb b/spec/selenium/assignments/assignments_spec.rb index e811429c266..6a20b8b2629 100644 --- a/spec/selenium/assignments/assignments_spec.rb +++ b/spec/selenium/assignments/assignments_spec.rb @@ -809,7 +809,7 @@ describe "assignments" do end it "shows submission scores for students on index page", priority: "2", test_id: 647850 do - @assignment.update_attributes(points_possible: 15) + @assignment.update(points_possible: 15) @assignment.publish course_with_student_logged_in(active_all: true, course: @course) @assignment.grade_student(@student, grade: 14, grader: @teacher) @@ -947,7 +947,7 @@ describe "assignments" do @course.start_at = nil @course.save! @assignment = @course.assignments.create({name: "Test Moderated Assignment"}) - @assignment.update_attributes( + @assignment.update( moderated_grading: true, grader_count: 1, final_grader: @teacher diff --git a/spec/selenium/assignments/assignments_student_observer_spec.rb b/spec/selenium/assignments/assignments_student_observer_spec.rb index 160961b4501..534d4a26747 100644 --- a/spec/selenium/assignments/assignments_student_observer_spec.rb +++ b/spec/selenium/assignments/assignments_student_observer_spec.rb @@ -50,7 +50,7 @@ describe "assignments" do context "with multiple section enrollments in same course" do it "should have the earliest 'lock until' date and the latest 'lock after' date" do - @assignment.update_attributes :lock_at => @lock_at + 22.days + @assignment.update :lock_at => @lock_at + 22.days @course.enroll_user(@observer, 'ObserverEnrollment', :section => @section1, :enrollment_state => 'active') extend TextHelper get "/courses/#{@course.id}/assignments/#{@assignment.id}" diff --git a/spec/selenium/assignments/assignments_student_spec.rb b/spec/selenium/assignments/assignments_student_spec.rb index db33ed168a8..362590d5d89 100644 --- a/spec/selenium/assignments/assignments_student_spec.rb +++ b/spec/selenium/assignments/assignments_student_spec.rb @@ -61,7 +61,7 @@ describe "assignments" do it "should not show submission data when muted" do assignment = @course.assignments.create!(:title => 'test assignment', :name => 'test assignment') - assignment.update_attributes(:submission_types => "online_url,online_upload") + assignment.update(:submission_types => "online_url,online_upload") submission = assignment.submit_homework(@student) submission.submission_type = "online_url" submission.save! @@ -136,7 +136,7 @@ describe "assignments" do get "/courses/#{@course.id}/assignments/#{locked_assignment.id}" expect(f('#content')).to include_text(format_date_for_view(unlock_time)) - locked_assignment.update_attributes(:unlock_at => Time.now) + locked_assignment.update(:unlock_at => Time.now) refresh_page # to show the updated assignment expect(f('#content')).not_to include_text('This assignment is locked until') end @@ -147,7 +147,7 @@ describe "assignments" do wait_for_no_such_element { f('[data-view="assignmentGroups"] .loadingIndicator') } wait_for_ajaximations expect(f("#assignment_group_past #assignment_#{due_date_assignment.id}")).to be_displayed - due_date_assignment.update_attributes(:due_at => 2.days.from_now) + due_date_assignment.update(:due_at => 2.days.from_now) refresh_page # to show the updated assignment expect(f("#assignment_group_upcoming #assignment_#{due_date_assignment.id}")).to be_displayed end @@ -187,7 +187,7 @@ describe "assignments" do end it "should allow submission when within override locks" do - @assignment.update_attributes(:submission_types => 'online_text_entry') + @assignment.update(:submission_types => 'online_text_entry') # Change unlock dates to be valid for submission @override.unlock_at = Time.now.utc - 1.days # available now @override.save! @@ -216,7 +216,7 @@ describe "assignments" do end it "should expand the comments box on click" do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') get "/courses/#{@course.id}/assignments/#{@assignment.id}" @@ -231,7 +231,7 @@ describe "assignments" do it "should validate file upload restrictions" do filename_txt, fullpath_txt, data_txt, tempfile_txt = get_file("testfile4.txt") filename_zip, fullpath_zip, data_zip, tempfile_zip = get_file("testfile5.zip") - @assignment.update_attributes(:submission_types => 'online_upload', :allowed_extensions => '.txt') + @assignment.update(:submission_types => 'online_upload', :allowed_extensions => '.txt') get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click @@ -259,7 +259,7 @@ describe "assignments" do end it "should have a google doc tab if google docs is enabled", priority: "1", test_id: 161884 do - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click wait_for_animations @@ -282,7 +282,7 @@ describe "assignments" do allow_any_instance_of(ApplicationController).to receive(:google_drive_connection).and_return(google_drive_connection) # create assignment - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click f("a[href*='submit_google_doc_form']").click @@ -313,7 +313,7 @@ describe "assignments" do allow(google_drive_connection).to receive(:authorized?).and_return(nil) allow_any_instance_of(ApplicationController).to receive(:google_drive_connection).and_return(google_drive_connection) - @assignment.update_attributes(:submission_types => 'online_upload') + @assignment.update(:submission_types => 'online_upload') get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click f("a[href*='submit_google_doc_form']").click diff --git a/spec/selenium/assignments/assignments_submissions_student_spec.rb b/spec/selenium/assignments/assignments_submissions_student_spec.rb index 1e50b21e659..5dea5a8f7ab 100644 --- a/spec/selenium/assignments/assignments_submissions_student_spec.rb +++ b/spec/selenium/assignments/assignments_submissions_student_spec.rb @@ -43,7 +43,7 @@ describe "submissions" do it "should let a student submit a text entry", :xbrowser, priority: "1", test_id: 56015 do skip_if_firefox('known issue with firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1335085') - @assignment.update_attributes(submission_types: "online_text_entry") + @assignment.update(submission_types: "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f(".submit_assignment_link").click @@ -55,7 +55,7 @@ describe "submissions" do end it "should not let a student submit a text entry with no text entered", priority: "2", test_id: 238143 do - @assignment.update_attributes(submission_types: "online_text_entry") + @assignment.update(submission_types: "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f(".submit_assignment_link").click @@ -190,7 +190,7 @@ describe "submissions" do # given @teacher = User.create! @course.enroll_teacher(@teacher) - @assignment.update_attributes(:submission_types => "online_text_entry") + @assignment.update(:submission_types => "online_text_entry") @assignment.grade_student(@student, grade: "0", grader: @teacher) # when get "/courses/#{@course.id}/assignments/#{@assignment.id}" @@ -203,7 +203,7 @@ describe "submissions" do # given @teacher = User.create! @course.enroll_teacher(@teacher) - @assignment.update_attributes(:submission_types => "on_paper") + @assignment.update(:submission_types => "on_paper") @assignment.grade_student(@student, grade: "0", grader: @teacher) # when get "/courses/#{@course.id}/assignments/#{@assignment.id}" @@ -230,7 +230,7 @@ describe "submissions" do end it "should not allow blank submissions for text entry", priority: "1", test_id: 237026 do - @assignment.update_attributes(:submission_types => "online_text_entry") + @assignment.update(:submission_types => "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click assignment_form = f('#submit_online_text_entry_form') @@ -252,7 +252,7 @@ describe "submissions" do it "should not allow a submission with only comments", priority: "1", test_id: 237027 do skip_if_safari(:alert) skip('flash alert is fragile, will be addressed in ADMIN-3015') - @assignment.update_attributes(:submission_types => "online_text_entry") + @assignment.update(:submission_types => "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click @@ -435,7 +435,7 @@ describe "submissions" do it "should load submission lti tool on clicking tab" do tool = create_submission_tool - @assignment.update_attributes(submission_types: "online_upload") + @assignment.update(submission_types: "online_upload") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f(".submit_assignment_link").click @@ -447,7 +447,7 @@ describe "submissions" do it "should load submission lti tool on kb-nav to tab" do tool = create_submission_tool - @assignment.update_attributes(submission_types: "online_upload") + @assignment.update(submission_types: "online_upload") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f(".submit_assignment_link").click diff --git a/spec/selenium/assignments/rcs/assignments_student_spec.rb b/spec/selenium/assignments/rcs/assignments_student_spec.rb index 28177454360..b34aa1e6f33 100644 --- a/spec/selenium/assignments/rcs/assignments_student_spec.rb +++ b/spec/selenium/assignments/rcs/assignments_student_spec.rb @@ -43,7 +43,7 @@ describe "assignments" do end it "should allow submission when within override locks" do - @assignment.update_attributes(:submission_types => 'online_text_entry') + @assignment.update(:submission_types => 'online_text_entry') # Change unlock dates to be valid for submission @override.unlock_at = Time.now.utc - 1.days # available now @override.save! diff --git a/spec/selenium/assignments/rcs/assignments_submissions_student_spec.rb b/spec/selenium/assignments/rcs/assignments_submissions_student_spec.rb index 5d602f0d045..e8b7eafbc66 100644 --- a/spec/selenium/assignments/rcs/assignments_submissions_student_spec.rb +++ b/spec/selenium/assignments/rcs/assignments_submissions_student_spec.rb @@ -43,7 +43,7 @@ describe "submissions" do end it "should let a student submit a text entry", priority: "1", test_id: 56015 do - @assignment.update_attributes(submission_types: "online_text_entry") + @assignment.update(submission_types: "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" wait_for_new_page_load { f(".submit_assignment_link").click } @@ -55,7 +55,7 @@ describe "submissions" do end it "should not let a student submit a text entry with no text entered", priority: "2", test_id: 238143 do - @assignment.update_attributes(submission_types: "online_text_entry") + @assignment.update(submission_types: "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" wait_for_new_page_load { f(".submit_assignment_link").click } @@ -68,7 +68,7 @@ describe "submissions" do # given @teacher = User.create! @course.enroll_teacher(@teacher) - @assignment.update_attributes(:submission_types => "online_text_entry") + @assignment.update(:submission_types => "online_text_entry") @assignment.grade_student(@student, grade: "0", grader: @teacher) # when get "/courses/#{@course.id}/assignments/#{@assignment.id}" @@ -78,7 +78,7 @@ describe "submissions" do end it "should not allow blank submissions for text entry", priority: "1", test_id: 237026 do - @assignment.update_attributes(:submission_types => "online_text_entry") + @assignment.update(:submission_types => "online_text_entry") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f('.submit_assignment_link').click assignment_form = f('#submit_online_text_entry_form') diff --git a/spec/selenium/course_settings_spec.rb b/spec/selenium/course_settings_spec.rb index 9ad93b0a762..bb8df6800da 100644 --- a/spec/selenium/course_settings_spec.rb +++ b/spec/selenium/course_settings_spec.rb @@ -128,7 +128,7 @@ describe "course settings" do a.courses << @course a.settings[:self_enrollment] = 'manually_created' a.save! - @course.update_attributes(:self_enrollment => true) + @course.update(:self_enrollment => true) MasterCourses::MasterTemplate.set_as_master_course(@course) get "/courses/#{@course.id}/settings" expect(f('.self_enrollment_message')).to_not be_displayed diff --git a/spec/selenium/courses_spec.rb b/spec/selenium/courses_spec.rb index db14a2f879a..abad21d4764 100644 --- a/spec/selenium/courses_spec.rb +++ b/spec/selenium/courses_spec.rb @@ -154,7 +154,7 @@ describe "courses" do it "should save quota when not changed" do # then try just saving it (without resetting it) course_with_admin_logged_in - @course.update_attributes!(storage_quota: 10.megabytes) + @course.update!(storage_quota: 10.megabytes) get "/courses/#{@course.id}/settings" form = f("#course_form") submit_form(form) @@ -211,7 +211,7 @@ describe "courses" do user_logged_in enrollment = @course.enroll_ta(@user) enrollment.accept! - enrollment.update_attributes(:limit_privileges_to_course_section => true, + enrollment.update(:limit_privileges_to_course_section => true, :course_section => CourseSection.where(name: 'Two').first) # Test that only users in the approved section are displayed. diff --git a/spec/selenium/dashboard_spec.rb b/spec/selenium/dashboard_spec.rb index 09e8aef174f..4a8316d3fa5 100644 --- a/spec/selenium/dashboard_spec.rb +++ b/spec/selenium/dashboard_spec.rb @@ -188,7 +188,7 @@ describe "dashboard" do # appointment group publish notification and signup notification appointment_participant_model(:course => @course, :participant => @group, :updating_user => @other_student) # appointment group update notification - @appointment_group.update_attributes(:new_appointments => [[Time.now.utc + 2.hour, Time.now.utc + 3.hour]]) + @appointment_group.update(:new_appointments => [[Time.now.utc + 2.hour, Time.now.utc + 3.hour]]) get "/" expect(ffj(".topic_message .communication_message.dashboard_notification").size).to eq 3 @@ -200,7 +200,7 @@ describe "dashboard" do describe "course menu" do before do - @course.update_attributes(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => false) + @course.update(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => false) Enrollment.update_all(:created_at => 1.minute.ago) get "/" end @@ -347,7 +347,7 @@ describe "dashboard" do term.save! c1 = @course c1.name = 'a_soft_concluded_course' - c1.update_attributes!(:enrollment_term => term) + c1.update!(:enrollment_term => term) c1.reload get "/courses" expect(fj("#past_enrollments_table a[href='/courses/#{@course.id}']")).to include_text(c1.name) @@ -380,13 +380,13 @@ describe "dashboard" do course_with_student(:active_all => true) @c1 = @course @c1.name = 'a future course' - @c1.update_attributes!(:enrollment_term => term) + @c1.update!(:enrollment_term => term) course_with_student(:active_course => true, :user => @student) @c2 = @course @c2.name = "a restricted future course" @c2.restrict_student_future_view = true - @c2.update_attributes!(:enrollment_term => term) + @c2.update!(:enrollment_term => term) end before do diff --git a/spec/selenium/dashboard_teacher_spec.rb b/spec/selenium/dashboard_teacher_spec.rb index 3aacb272844..e00bac9b3c5 100644 --- a/spec/selenium/dashboard_teacher_spec.rb +++ b/spec/selenium/dashboard_teacher_spec.rb @@ -33,7 +33,7 @@ describe "dashboard" do term.save! c1 = @course c1.name = 'a_soft_concluded_course' - c1.update_attributes!(:enrollment_term => term) + c1.update!(:enrollment_term => term) c1.reload get "/courses" diff --git a/spec/selenium/grades/gradebook/gradebook_group_weight_spec.rb b/spec/selenium/grades/gradebook/gradebook_group_weight_spec.rb index e46b76e74a2..43f16cccddc 100644 --- a/spec/selenium/grades/gradebook/gradebook_group_weight_spec.rb +++ b/spec/selenium/grades/gradebook/gradebook_group_weight_spec.rb @@ -42,7 +42,7 @@ describe "group weights" do before(:each) do course_with_teacher_logged_in student_in_course - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') @group1 = @course.assignment_groups.create!(name: 'first assignment group', group_weight: 50) @group2 = @course.assignment_groups.create!(name: 'second assignment group', group_weight: 50) @assignment1 = assignment_model({ @@ -69,7 +69,7 @@ describe "group weights" do @assignment2.grade_student @student, grade: 5, grader: @teacher @course.show_total_grade_as_points = true - @course.update_attributes(group_weighting_scheme: 'points') + @course.update(group_weighting_scheme: 'points') # Displays total column as points Gradebook.visit_gradebook(@course) @@ -81,7 +81,7 @@ describe "group weights" do @assignment2.grade_student @student, grade: 5, grader: @teacher @course.show_total_grade_as_points = false - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') # Displays total column as points Gradebook.visit_gradebook(@course) @@ -92,7 +92,7 @@ describe "group weights" do before(:each) do course_with_teacher_logged_in student_in_course - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') @group1 = @course.assignment_groups.create!(name: 'first assignment group', group_weight: 50) @group2 = @course.assignment_groups.create!(name: 'second assignment group', group_weight: 50) @assignment1 = assignment_model({ diff --git a/spec/selenium/grades/gradebook/gradebook_pass_fail_assignment_spec.rb b/spec/selenium/grades/gradebook/gradebook_pass_fail_assignment_spec.rb index 337d5da256a..6b52a1a8906 100644 --- a/spec/selenium/grades/gradebook/gradebook_pass_fail_assignment_spec.rb +++ b/spec/selenium/grades/gradebook/gradebook_pass_fail_assignment_spec.rb @@ -38,7 +38,7 @@ describe "gradebook" do end it 'should display pass/fail correctly when total points possible is changed', priority: "1", test_id: 419288 do - @assignment.update_attributes(points_possible: 1) + @assignment.update(points_possible: 1) get "/courses/#{@course.id}/gradebook" expect(f('button.gradebook-checkbox.gradebook-checkbox-pass')).to include_text('pass') end diff --git a/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb b/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb index bc151eb8c73..25887043415 100644 --- a/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb +++ b/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb @@ -138,7 +138,7 @@ describe "Gradezilla - Assignment Column" do # re-use the course and student setup from the describe block up-above # update assignment to be an anonymous assignment - @assignment.update_attributes(title: "Anon Assignment", anonymous_grading: true) + @assignment.update(title: "Anon Assignment", anonymous_grading: true) # visit new gradebook as teacher Gradezilla.visit(@course) diff --git a/spec/selenium/grades/gradezilla/gradebook_group_weight_spec.rb b/spec/selenium/grades/gradezilla/gradebook_group_weight_spec.rb index d11aba541fc..98a8d49afb3 100644 --- a/spec/selenium/grades/gradezilla/gradebook_group_weight_spec.rb +++ b/spec/selenium/grades/gradezilla/gradebook_group_weight_spec.rb @@ -42,7 +42,7 @@ describe "Gradezilla - group weights" do before(:each) do course_with_teacher_logged_in student_in_course - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') @group1 = @course.assignment_groups.create!(name: 'first assignment group', group_weight: 50) @group2 = @course.assignment_groups.create!(name: 'second assignment group', group_weight: 50) @assignment1 = assignment_model({ @@ -69,7 +69,7 @@ describe "Gradezilla - group weights" do @assignment2.grade_student @student, grade: 5, grader: @teacher @course.show_total_grade_as_points = true - @course.update_attributes(group_weighting_scheme: 'points') + @course.update(group_weighting_scheme: 'points') # Displays total column as points Gradezilla.visit(@course) @@ -81,7 +81,7 @@ describe "Gradezilla - group weights" do @assignment2.grade_student @student, grade: 5, grader: @teacher @course.show_total_grade_as_points = false - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') # Displays total column as points Gradezilla.visit(@course) @@ -92,7 +92,7 @@ describe "Gradezilla - group weights" do before(:each) do course_with_teacher_logged_in student_in_course - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') @group1 = @course.assignment_groups.create!(name: 'first assignment group', group_weight: 50) @group2 = @course.assignment_groups.create!(name: 'second assignment group', group_weight: 50) @assignment1 = assignment_model({ diff --git a/spec/selenium/grades/gradezilla/gradebook_pass_fail_assignment_spec.rb b/spec/selenium/grades/gradezilla/gradebook_pass_fail_assignment_spec.rb index d0290e1fff3..ea126f3ec6b 100644 --- a/spec/selenium/grades/gradezilla/gradebook_pass_fail_assignment_spec.rb +++ b/spec/selenium/grades/gradezilla/gradebook_pass_fail_assignment_spec.rb @@ -40,7 +40,7 @@ describe "Gradezilla" do end it 'should display pass/fail correctly when total points possible is changed', priority: "1", test_id: 419288 do - @assignment.update_attributes(points_possible: 1) + @assignment.update(points_possible: 1) Gradezilla.visit(@course) expect(Gradezilla::Cells.get_grade(@students[0], @assignment)).to eq 'Complete' end diff --git a/spec/selenium/grades/integration/weight_conditions.rb b/spec/selenium/grades/integration/weight_conditions.rb index e6fa091fd3c..000eb0004d4 100644 --- a/spec/selenium/grades/integration/weight_conditions.rb +++ b/spec/selenium/grades/integration/weight_conditions.rb @@ -18,40 +18,40 @@ shared_context 'no grading period or assignment group weighting' do before(:each) do # C3058158 - @gpg.update_attributes(weighted: false) + @gpg.update(weighted: false) # assignment weighting: `percent` is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "points") + @course.update(group_weighting_scheme: "points") end end shared_context 'assignment group weights' do before(:each) do # C3058159 - @gpg.update_attributes(weighted: false) + @gpg.update(weighted: false) # assignment weighting: `percent` is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "percent") + @course.update(group_weighting_scheme: "percent") end end shared_context 'grading period weights' do before(:each) do # C3058160 - @gpg.update_attributes(weighted: true) - @gp1.update_attributes(weight: 30) - @gp2.update_attributes(weight: 70) + @gpg.update(weighted: true) + @gp1.update(weight: 30) + @gp2.update(weight: 70) # assignment weighting: `percent` is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "points") + @course.update(group_weighting_scheme: "points") end end shared_context 'both grading period and assignment group weights' do before(:each) do # C3058161 - @gpg.update_attributes(weighted: true) - @gp1.update_attributes(weight: 30) - @gp2.update_attributes(weight: 70) + @gpg.update(weighted: true) + @gp1.update(weight: 30) + @gp2.update(weight: 70) # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "percent") + @course.update(group_weighting_scheme: "percent") end end @@ -59,11 +59,11 @@ shared_context 'grading period weights with ungraded assignment' do before(:each) do # C 47.67%" - @gpg.update_attributes(weighted: true) - @gp1.update_attributes(weight: 30) - @gp2.update_attributes(weight: 70) + @gpg.update(weighted: true) + @gp1.update(weight: 30) + @gp2.update(weight: 70) # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "points") + @course.update(group_weighting_scheme: "points") @a5 = @course.assignments.create!( title: 'assignment five', @@ -78,24 +78,24 @@ end shared_context 'assign outside of weighted grading period' do before(:each) do # C3058164 - @gpg.update_attributes(weighted: true) - @gp1.update_attributes(weight: 30) - @gp2.update_attributes(weight: 70) + @gpg.update(weighted: true) + @gp1.update(weight: 30) + @gp2.update(weight: 70) # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "percent") + @course.update(group_weighting_scheme: "percent") - @a2.update_attributes(due_at: 3.weeks.ago) + @a2.update(due_at: 3.weeks.ago) end end shared_context 'assign outside of unweighted grading period' do before(:each) do # C3058165 - @gpg.update_attributes(weighted: false) + @gpg.update(weighted: false) # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "percent") + @course.update(group_weighting_scheme: "percent") - @a2.update_attributes(due_at: 3.weeks.ago) + @a2.update(due_at: 3.weeks.ago) end end @@ -104,9 +104,9 @@ shared_context 'no grading periods or assignment weighting' do # C3058162 associate_course_to_term("Default Term") # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "points") + @course.update(group_weighting_scheme: "points") - @a2.update_attributes(due_at: 3.weeks.ago) + @a2.update(due_at: 3.weeks.ago) end end @@ -115,8 +115,8 @@ shared_context 'assignment weighting and no grading periods' do # C3058163 associate_course_to_term("Default Term") # assignment weighting: 'percent' is on, 'points' is off - @course.update_attributes(group_weighting_scheme: "percent") + @course.update(group_weighting_scheme: "percent") - @a2.update_attributes(due_at: 3.weeks.ago) + @a2.update(due_at: 3.weeks.ago) end end diff --git a/spec/selenium/grades/integration/weighting_setup.rb b/spec/selenium/grades/integration/weighting_setup.rb index dc188698bc6..3f00107ace1 100644 --- a/spec/selenium/grades/integration/weighting_setup.rb +++ b/spec/selenium/grades/integration/weighting_setup.rb @@ -63,7 +63,7 @@ module WeightingSetup backend_group_helper = Factories::GradingPeriodGroupHelper.new @gpg = backend_group_helper.create_for_account_with_term(Account.default, @term_name) - @gpg.update_attributes(display_totals_for_all_grading_periods: true) + @gpg.update(display_totals_for_all_grading_periods: true) backend_period_helper = Factories::GradingPeriodHelper.new @gp1 = backend_period_helper.create_for_group(@gpg, { diff --git a/spec/selenium/grades/speedgrader/speedgrader_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_spec.rb index 68f95f69b65..eccd5944c8f 100644 --- a/spec/selenium/grades/speedgrader/speedgrader_spec.rb +++ b/spec/selenium/grades/speedgrader/speedgrader_spec.rb @@ -160,7 +160,7 @@ describe 'Speedgrader' do end it 'should display pass/fail correctly when total points possible is changed', priority: "1", test_id: 419289 do - @assignment.update_attributes(points_possible: 1) + @assignment.update(points_possible: 1) refresh_page expect(Speedgrader.grade_input).to have_value('complete') expect(Speedgrader.points_possible_label).to include_text('(1 / 1)') @@ -719,7 +719,7 @@ describe 'Speedgrader' do end it "shows dialog when attempting to mute and mutes" do - @assignment.update_attributes(muted: false) + @assignment.update(muted: false) Speedgrader.visit(@course.id, @assignment.id) f('#mute_link').click @@ -730,7 +730,7 @@ describe 'Speedgrader' do end it "shows dialog when attempting to unmute and unmutes" do - @assignment.update_attributes(muted: true) + @assignment.update(muted: true) get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}#" f('#mute_link').click diff --git a/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb index 05c6fbb0c8c..ba391a7cc25 100644 --- a/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb +++ b/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb @@ -78,7 +78,7 @@ describe "speed grader" do context "url submissions" do before do - @assignment.update_attributes! submission_types: 'online_url', + @assignment.update! submission_types: 'online_url', title: "url submission" student_in_course @assignment.submit_homework(@student, submission_type: "online_url", workflow_state: "submitted", url: "http://www.instructure.com") diff --git a/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb index a5ba5b9a612..f945d876563 100644 --- a/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb +++ b/spec/selenium/grades/speedgrader/speedgrader_teacher_submission_spec.rb @@ -333,7 +333,7 @@ describe "speed grader submissions" do it "should successfully schedule resubmit when button is clicked", priority: "1", test_id: 283508 do account = @assignment.context.account - account.update_attributes(turnitin_account_id: 'test_account', + account.update(turnitin_account_id: 'test_account', turnitin_shared_secret: 'skeret', settings: account.settings.merge(enable_turnitin: true)) diff --git a/spec/selenium/grades/student_grades_page/student_grades_page_spec.rb b/spec/selenium/grades/student_grades_page/student_grades_page_spec.rb index 8ecff0a0368..717bb871029 100644 --- a/spec/selenium/grades/student_grades_page/student_grades_page_spec.rb +++ b/spec/selenium/grades/student_grades_page/student_grades_page_spec.rb @@ -73,7 +73,7 @@ describe "gradebook - logged in as a student" do before do # create term term = @course.root_account.enrollment_terms.create! - @course.update_attributes(enrollment_term: term) + @course.update(enrollment_term: term) # create group and periods group = backend_group_helper.create_for_account(@course.root_account) diff --git a/spec/selenium/grades/student_grades_summary/grades_spec.rb b/spec/selenium/grades/student_grades_summary/grades_spec.rb index 5cc02ca7161..86ccbb84ec3 100644 --- a/spec/selenium/grades/student_grades_summary/grades_spec.rb +++ b/spec/selenium/grades/student_grades_summary/grades_spec.rb @@ -379,7 +379,7 @@ describe "grades" do @first_assignment.grade_student(s, grade: 4, grader: @teacher) end # but then prevent them at the course levels - @course.update_attributes(hide_distribution_graphs: true) + @course.update(hide_distribution_graphs: true) StudentGradesPage.visit_as_student(@course) expect(f("#content")).not_to contain_css("#grade_info_#{@first_assignment.id} .tooltip") diff --git a/spec/selenium/groups_pages_student_spec.rb b/spec/selenium/groups_pages_student_spec.rb index 9d74fa3cabf..000de762251 100644 --- a/spec/selenium/groups_pages_student_spec.rb +++ b/spec/selenium/groups_pages_student_spec.rb @@ -81,7 +81,7 @@ describe "groups" do category = course.group_categories.create!(name: 'category') course.groups.create!(name: "Test Group", group_category: category) course.groups.first.add_user student - course.update_attributes(conclude_at: 1.day.ago, workflow_state: 'completed') + course.update(conclude_at: 1.day.ago, workflow_state: 'completed') user_session(student) get "/groups/#{course.groups.first.id}" @@ -103,7 +103,7 @@ describe "groups" do category = course.group_categories.create!(name: 'category') course.groups.create!(name: "Test Group", group_category: category) course.groups.first.add_user student - course.update_attributes(conclude_at: 1.day.ago, workflow_state: 'completed') + course.update(conclude_at: 1.day.ago, workflow_state: 'completed') user_session(teacher) url = "/groups/#{course.groups.first.id}" diff --git a/spec/selenium/helpers/announcements_common.rb b/spec/selenium/helpers/announcements_common.rb index 15bf564594c..c0b7dc490a2 100644 --- a/spec/selenium/helpers/announcements_common.rb +++ b/spec/selenium/helpers/announcements_common.rb @@ -54,7 +54,7 @@ module AnnouncementsCommon end def update_attributes_and_validate(attribute, update_value, search_term = update_value, expected_results = 1) - what_to_create.last.update_attributes(attribute => update_value) + what_to_create.last.update(attribute => update_value) refresh_page # in order to get the new topic information replace_content(f('#searchTerm'), search_term) expect(ff('.ic-announcement-row').count).to eq expected_results diff --git a/spec/selenium/helpers/basic/statistics_specs.rb b/spec/selenium/helpers/basic/statistics_specs.rb index 10c435a3178..0b51a041a1b 100644 --- a/spec/selenium/helpers/basic/statistics_specs.rb +++ b/spec/selenium/helpers/basic/statistics_specs.rb @@ -61,7 +61,7 @@ shared_examples_for "statistics basic tests" do it "should validate recently ended courses display" do skip('spec is broken on sub account level') if account != Account.default concluded_course = Course.create!(:name => 'concluded course', :account => account) - concluded_course.update_attributes(:conclude_at => 1.day.ago) + concluded_course.update(:conclude_at => 1.day.ago) get url validate_item_list(list_css[:ended], concluded_course.name) end diff --git a/spec/selenium/helpers/conversations_common.rb b/spec/selenium/helpers/conversations_common.rb index 7aa707346a3..f9777468623 100644 --- a/spec/selenium/helpers/conversations_common.rb +++ b/spec/selenium/helpers/conversations_common.rb @@ -41,7 +41,7 @@ module ConversationsCommon term.root_account_id = @course.root_account_id term.save! - @course.update_attributes! :enrollment_term => term + @course.update! :enrollment_term => term end def conversation_elements diff --git a/spec/selenium/helpers/legacy_announcements_common.rb b/spec/selenium/helpers/legacy_announcements_common.rb index 1a18d418058..98e924c2407 100644 --- a/spec/selenium/helpers/legacy_announcements_common.rb +++ b/spec/selenium/helpers/legacy_announcements_common.rb @@ -54,7 +54,7 @@ module AnnouncementsCommon end def update_attributes_and_validate(attribute, update_value, search_term = update_value, expected_results = 1) - what_to_create.last.update_attributes(attribute => update_value) + what_to_create.last.update(attribute => update_value) refresh_page # in order to get the new topic information replace_content(f('#searchTerm'), search_term) expect(ff('.discussionTopicIndexList .discussion-topic').count).to eq expected_results diff --git a/spec/selenium/master_courses/blueprint_teacher_history_spec.rb b/spec/selenium/master_courses/blueprint_teacher_history_spec.rb index e2a710c4e4a..c6a7960eb68 100644 --- a/spec/selenium/master_courses/blueprint_teacher_history_spec.rb +++ b/spec/selenium/master_courses/blueprint_teacher_history_spec.rb @@ -46,10 +46,10 @@ describe "master courses - child courses - sync history for teacher" do topic = @copy_from.discussion_topics.create!(title: "something") run_master_migration # run the full export initially - assmt.update_attributes(due_at: 3.days.from_now) # updated - topic.update_attributes(title: "something new") # updated but won't apply + assmt.update(due_at: 3.days.from_now) # updated + topic.update(title: "something new") # updated but won't apply topic_to = @copy_to.discussion_topics.first - topic_to.update_attributes(title: "something that won't get overwritten") + topic_to.update(title: "something that won't get overwritten") page = @copy_from.wiki_pages.create!(title: "page") # new object run_master_migration # run selective export diff --git a/spec/selenium/multiple_grading_periods_spec.rb b/spec/selenium/multiple_grading_periods_spec.rb index 737d0e2acbd..cdd7538b8ee 100644 --- a/spec/selenium/multiple_grading_periods_spec.rb +++ b/spec/selenium/multiple_grading_periods_spec.rb @@ -144,7 +144,7 @@ describe "interaction with grading periods" do end it 'should list an assignment from a current grading period when due date is updated', priority: "2", test_course: 576764 do - assignment.update_attributes(due_at: 3.days.from_now(now)) + assignment.update(due_at: 3.days.from_now(now)) user_session(teacher) get "/courses/#{test_course.id}/assignments" expect(f("#assignment_#{assignment.id} a.ig-title")).to include_text('Assignment 1') diff --git a/spec/selenium/new_files_student_spec.rb b/spec/selenium/new_files_student_spec.rb index 5474971402b..e8b748d0d14 100644 --- a/spec/selenium/new_files_student_spec.rb +++ b/spec/selenium/new_files_student_spec.rb @@ -93,7 +93,7 @@ describe "better_file_browsing" do end it "should see calendar icon on restricted files within a given timeframe", priority: "1", test_id: 133108 do - @files[0].update_attributes unlock_at: Time.zone.now - 1.week, + @files[0].update unlock_at: Time.zone.now - 1.week, lock_at: Time.zone.now + 1.week get "/courses/#{@course.id}/files" expect(f('.icon-calendar-day')).to be_displayed diff --git a/spec/selenium/quizzes/quizzes_observer_spec.rb b/spec/selenium/quizzes/quizzes_observer_spec.rb index 236b95c7594..308edd01106 100644 --- a/spec/selenium/quizzes/quizzes_observer_spec.rb +++ b/spec/selenium/quizzes/quizzes_observer_spec.rb @@ -34,7 +34,7 @@ describe 'quizzes observers' do context "when 'show correct answers after last attempt setting' is on" do before(:each) do quiz_with_submission - @quiz.update_attributes(:show_correct_answers => true, + @quiz.update(:show_correct_answers => true, :show_correct_answers_last_attempt => true, :allowed_attempts => 2) @quiz.save! end diff --git a/spec/selenium/quizzes/quizzes_student_spec.rb b/spec/selenium/quizzes/quizzes_student_spec.rb index 023f11a1414..6c30dee95a0 100644 --- a/spec/selenium/quizzes/quizzes_student_spec.rb +++ b/spec/selenium/quizzes/quizzes_student_spec.rb @@ -58,7 +58,7 @@ describe 'quizzes' do context 'when attempting to resume a quiz' do def update_quiz_lock(lock_at, unlock_at) - @quiz.update_attributes(lock_at: lock_at, unlock_at: unlock_at) + @quiz.update(lock_at: lock_at, unlock_at: unlock_at) end describe 'on individual quiz page' do @@ -171,7 +171,7 @@ describe 'quizzes' do context 'when the \'show correct answers\' setting is on' do before(:once) do quiz_with_submission - @quiz.update_attributes(show_correct_answers: true) + @quiz.update(show_correct_answers: true) @quiz.save! end @@ -191,7 +191,7 @@ describe 'quizzes' do context "when 'show correct answers after last attempt setting' is on" do before(:each) do quiz_with_submission - @quiz.update_attributes(:show_correct_answers => true, + @quiz.update(:show_correct_answers => true, :show_correct_answers_last_attempt => true, :allowed_attempts => 2) @quiz.save! end @@ -212,7 +212,7 @@ describe 'quizzes' do before(:once) do quiz_with_submission - @quiz.update_attributes(show_correct_answers: false) + @quiz.update(show_correct_answers: false) @quiz.save! end diff --git a/spec/selenium/quizzes/quizzes_student_with_draft_state_spec.rb b/spec/selenium/quizzes/quizzes_student_with_draft_state_spec.rb index 06912bcdcc2..c0c871a8d92 100644 --- a/spec/selenium/quizzes/quizzes_student_with_draft_state_spec.rb +++ b/spec/selenium/quizzes/quizzes_student_with_draft_state_spec.rb @@ -27,7 +27,7 @@ describe 'quizzes with draft state' do before(:each) do course_with_student_logged_in - @course.update_attributes(name: 'teacher course') + @course.update(name: 'teacher course') @course.save! @course.reload diff --git a/spec/selenium/quizzes/quizzes_teacher_spec.rb b/spec/selenium/quizzes/quizzes_teacher_spec.rb index d380ea29902..9a6eea91e2b 100644 --- a/spec/selenium/quizzes/quizzes_teacher_spec.rb +++ b/spec/selenium/quizzes/quizzes_teacher_spec.rb @@ -39,7 +39,7 @@ describe "quizzes" do before(:once) do course_with_teacher(active_all: true) course_with_student(course: @course, active_enrollment: true) - @course.update_attributes(:name => 'teacher course') + @course.update(:name => 'teacher course') @course.save! @course.reload end diff --git a/spec/selenium/quizzes/quizzes_teacher_with_draft_state_spec.rb b/spec/selenium/quizzes/quizzes_teacher_with_draft_state_spec.rb index 48ec2774b25..5394f8f737e 100644 --- a/spec/selenium/quizzes/quizzes_teacher_with_draft_state_spec.rb +++ b/spec/selenium/quizzes/quizzes_teacher_with_draft_state_spec.rb @@ -26,7 +26,7 @@ describe 'quizzes with draft state' do before(:each) do course_with_teacher_logged_in - @course.update_attributes(name: 'teacher course') + @course.update(name: 'teacher course') @course.save! @course.reload create_quiz_with_due_date diff --git a/spec/selenium/quizzes/rcs/quizzes_teacher_spec.rb b/spec/selenium/quizzes/rcs/quizzes_teacher_spec.rb index 6f874bc6741..c13664a8e64 100644 --- a/spec/selenium/quizzes/rcs/quizzes_teacher_spec.rb +++ b/spec/selenium/quizzes/rcs/quizzes_teacher_spec.rb @@ -39,7 +39,7 @@ describe "quizzes" do before(:once) do course_with_teacher(active_all: true) course_with_student(course: @course, active_enrollment: true) - @course.update_attributes(:name => 'teacher course') + @course.update(:name => 'teacher course') @course.save! @course.reload end diff --git a/spec/selenium/rcs/groups_pages_student_spec.rb b/spec/selenium/rcs/groups_pages_student_spec.rb index 8d4d1480bf0..62ea7840c8e 100644 --- a/spec/selenium/rcs/groups_pages_student_spec.rb +++ b/spec/selenium/rcs/groups_pages_student_spec.rb @@ -83,7 +83,7 @@ describe "groups" do category = course.group_categories.create!(name: 'category') course.groups.create!(name: "Test Group", group_category: category) course.groups.first.add_user student - course.update_attributes(conclude_at: 1.day.ago, workflow_state: 'completed') + course.update(conclude_at: 1.day.ago, workflow_state: 'completed') user_session(student) get "/groups/#{course.groups.first.id}" @@ -105,7 +105,7 @@ describe "groups" do category = course.group_categories.create!(name: 'category') course.groups.create!(name: "Test Group", group_category: category) course.groups.first.add_user student - course.update_attributes(conclude_at: 1.day.ago, workflow_state: 'completed') + course.update(conclude_at: 1.day.ago, workflow_state: 'completed') user_session(teacher) url = "/groups/#{course.groups.first.id}" diff --git a/spec/selenium/submission_types_spec.rb b/spec/selenium/submission_types_spec.rb index 9ba97dc11ae..8864a8acec1 100644 --- a/spec/selenium/submission_types_spec.rb +++ b/spec/selenium/submission_types_spec.rb @@ -28,7 +28,7 @@ describe "assignments" do end def update_assignment_attributes(assignment, attribute, values, click_submit_link = true) - assignment.update_attributes(attribute => values) + assignment.update(attribute => values) get "/courses/#{@course.id}/assignments/#{assignment.id}" f('.submit_assignment_link').click if click_submit_link end @@ -44,7 +44,7 @@ describe "assignments" do end it "should validate an assignment created with the type of discussion" do - @assignment.update_attributes(:submission_types => 'discussion_topic') + @assignment.update(:submission_types => 'discussion_topic') get "/courses/#{@course.id}/assignments/#{@assignment.id}" @@ -53,7 +53,7 @@ describe "assignments" do end it "should validate an assignment created with the type of not graded" do - @assignment.update_attributes(:submission_types => 'not_graded') + @assignment.update(:submission_types => 'not_graded') get "/courses/#{@course.id}/assignments/#{@assignment.id}" expect(f("#content")).not_to contain_css('.submit_assignment_link') diff --git a/spec/selenium/wiki_and_tiny_teacher_spec.rb b/spec/selenium/wiki_and_tiny_teacher_spec.rb index ede9af73b01..fc8c39e2df8 100644 --- a/spec/selenium/wiki_and_tiny_teacher_spec.rb +++ b/spec/selenium/wiki_and_tiny_teacher_spec.rb @@ -100,7 +100,7 @@ describe "Wiki pages and Tiny WYSIWYG editor" do p = create_wiki_page(title, unpublished, edit_roles) #sets body - p.update_attributes(:body => "test") + p.update(:body => "test") get "/courses/#{@course.id}/pages/#{p.title}" @@ -120,8 +120,8 @@ describe "Wiki pages and Tiny WYSIWYG editor" do p = create_wiki_page(title, unpublished, edit_roles) #sets body and then resets it for history verification - p.update_attributes(:body => body) - p.update_attributes(:body => "sample") + p.update(:body => body) + p.update(:body => "sample") get "/courses/#{@course.id}/pages/#{p.title}/revisions" wait_for_ajaximations diff --git a/spec/serializers/lti/ims/line_items_serializer_spec.rb b/spec/serializers/lti/ims/line_items_serializer_spec.rb index cde74ee50be..9d544dfefb5 100644 --- a/spec/serializers/lti/ims/line_items_serializer_spec.rb +++ b/spec/serializers/lti/ims/line_items_serializer_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Lti::Ims::LineItemsSerializer do end it 'does not incude values that are nil' do - line_item.update_attributes!(resource_link: nil, tag: nil) + line_item.update!(resource_link: nil, tag: nil) expect(described_class.new(line_item, line_item_id).as_json).to eq( { id: line_item_id, diff --git a/spec/views/courses/index.html.erb_spec.rb b/spec/views/courses/index.html.erb_spec.rb index 11ad90cc942..44f69658f94 100644 --- a/spec/views/courses/index.html.erb_spec.rb +++ b/spec/views/courses/index.html.erb_spec.rb @@ -48,7 +48,7 @@ describe "/courses/index" do term = EnrollmentTerm.new(:name => "term", :start_at => 1.week.from_now, :end_at => 1.month.from_now) course_with_student @course.restrict_student_future_view = true - @course.update_attributes!(:enrollment_term => term) + @course.update!(:enrollment_term => term) group_with_user(:user => @user, :group_context => @course) view_context