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: '

this is a media comment

' ) @@ -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: '

this is a media comment

' ) @@ -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: %|Hi Content| + assignment.update description: %|Hi Content| end it "includes description when lock settings allow" do @@ -159,14 +159,14 @@ describe Types::AssignmentType do end it "returns nil when allowed_attempts is an invalid non-positive value" do - assignment.update_attributes allowed_attempts: 0 + assignment.update allowed_attempts: 0 expect(assignment_type.resolve("allowedAttempts")).to eq nil - assignment.update_attributes allowed_attempts: -1 + assignment.update allowed_attempts: -1 expect(assignment_type.resolve("allowedAttempts")).to eq nil end it "returns allowed_attempts value set on the assignment" do - assignment.update_attributes allowed_attempts: 7 + assignment.update allowed_attempts: 7 expect(assignment_type.resolve("allowedAttempts")).to eq 7 end @@ -469,7 +469,7 @@ describe Types::AssignmentType do it "works for groups" do gc = assignment.group_category = GroupCategory.create! name: "asdf", context: course group = gc.groups.create! name: "group", context: course - assignment.update_attributes group_category: gc + assignment.update group_category: gc group_override = assignment.assignment_overrides.create!(set: group) expect( assignment_type.resolve(<<~GQL, current_user: teacher) @@ -533,7 +533,7 @@ describe Types::AssignmentType do end it "works when lock_info is a hash" do - assignment.update_attributes! unlock_at: 1.month.from_now + assignment.update! unlock_at: 1.month.from_now expect(assignment_type.resolve("lockInfo { isLocked }")).to eq true end end diff --git a/spec/graphql/types/course_type_spec.rb b/spec/graphql/types/course_type_spec.rb index 43016bbca0e..e1852a3ae36 100644 --- a/spec/graphql/types/course_type_spec.rb +++ b/spec/graphql/types/course_type_spec.rb @@ -64,7 +64,7 @@ describe Types::CourseType do before(:once) do gpg = GradingPeriodGroup.create! title: "asdf", root_account: course.root_account - course.enrollment_term.update_attributes grading_period_group: gpg + course.enrollment_term.update grading_period_group: gpg @term1 = gpg.grading_periods.create! title: "past grading period", start_date: 2.weeks.ago, end_date: 1.weeks.ago @@ -396,7 +396,7 @@ describe Types::CourseType do describe "term" do before(:once) do - course.enrollment_term.update_attributes(start_at: 1.month.ago) + course.enrollment_term.update(start_at: 1.month.ago) end it "works" do diff --git a/spec/graphql/types/group_set_type_spec.rb b/spec/graphql/types/group_set_type_spec.rb index 74e5259d9d4..dc90e46c4b6 100644 --- a/spec/graphql/types/group_set_type_spec.rb +++ b/spec/graphql/types/group_set_type_spec.rb @@ -55,7 +55,7 @@ describe Types::GroupSetType do end it "returns 'disabled' for null self_signup" do - @group_set.update_attributes! self_signup: nil + @group_set.update! self_signup: nil expect(group_set_type.resolve("selfSignup")).to eq "disabled" end end diff --git a/spec/graphql/types/rubric_assessment_type_spec.rb b/spec/graphql/types/rubric_assessment_type_spec.rb index 66a74d6bf49..260ce40b455 100644 --- a/spec/graphql/types/rubric_assessment_type_spec.rb +++ b/spec/graphql/types/rubric_assessment_type_spec.rb @@ -51,8 +51,8 @@ describe Types::RubricAssessmentType do end it 'requires permission to see the assessor' do - assignment.update_attributes(anonymous_peer_reviews: true) - rubric_assessment.update_attributes(assessment_type: 'no_reason') + assignment.update(anonymous_peer_reviews: true) + rubric_assessment.update(assessment_type: 'no_reason') expect( submission_type.resolve( 'rubricAssessmentsConnection { nodes { assessor { _id } } }', diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb index 766f4f93f5f..a424569c50b 100644 --- a/spec/graphql/types/user_type_spec.rb +++ b/spec/graphql/types/user_type_spec.rb @@ -62,7 +62,7 @@ describe Types::UserType do context "avatarUrl" do before(:once) do - @student.update_attributes! avatar_image_url: 'not-a-fallback-avatar.png' + @student.update! avatar_image_url: 'not-a-fallback-avatar.png' end it "is nil when avatars are not enabled" do @@ -76,7 +76,7 @@ describe Types::UserType do it "returns nil when a user has no avatar" do user.account.enable_service(:avatars) - user.update_attributes! avatar_image_url: nil + user.update! avatar_image_url: nil expect(user_type.resolve("avatarUrl")).to be_nil end end @@ -130,7 +130,7 @@ describe Types::UserType do context "email" do before(:once) do - @student.update_attributes! email: "cooldude@example.com" + @student.update! email: "cooldude@example.com" end it "returns email for teachers/admins" do diff --git a/spec/helpers/assignments_helper_spec.rb b/spec/helpers/assignments_helper_spec.rb index bcd0286d570..d5117715b48 100644 --- a/spec/helpers/assignments_helper_spec.rb +++ b/spec/helpers/assignments_helper_spec.rb @@ -89,7 +89,7 @@ describe AssignmentsHelper do student_in_course(active_all: true) assignment_model(course: @course) @assignment.turnitin_enabled = true - @assignment.update_attributes!({ + @assignment.update!({ submission_types: ["online_url"] }) @context = @assignment.context @@ -105,14 +105,14 @@ describe AssignmentsHelper do end it "returns false if the assignment does not require submissions" do - @assignment.update_attributes!({ + @assignment.update!({ submission_types: ["none"] }) expect(turnitin_active?).to be_falsey end it "returns false if turnitin is disabled on the account level" do - @context.account.update_attributes!({ + @context.account.update!({ turnitin_account_id: nil, turnitin_shared_secret: nil }) diff --git a/spec/helpers/broken_link_helper_spec.rb b/spec/helpers/broken_link_helper_spec.rb index 4aefd2b39d8..6c9f196048b 100644 --- a/spec/helpers/broken_link_helper_spec.rb +++ b/spec/helpers/broken_link_helper_spec.rb @@ -46,7 +46,7 @@ describe BrokenLinkHelper, type: :controller do it 'should return false if the location is not found in the referrer body' do allow(request).to receive(:referer).and_return "/courses/#{@course.id}/assignments/#{@assignment.id}" allow(request).to receive(:path).and_return '/bad_link' - @assignment.update_attributes(description: 'stuff') + @assignment.update(description: 'stuff') expect(send_broken_content!).to be false end @@ -96,8 +96,8 @@ describe BrokenLinkHelper, type: :controller do it 'should return true for unpublished content' do linked_assignment = @assignment - assignment_model(course: @course).update_attributes(workflow_state: 'unpublished') - linked_assignment.update_attributes(description: "Unpublished Assignment") + assignment_model(course: @course).update(workflow_state: 'unpublished') + linked_assignment.update(description: "Unpublished Assignment") allow(request).to receive(:referer).and_return "/courses/#{@course.id}/assignments/#{linked_assignment.id}" allow(request).to receive(:path).and_return "/courses/#{@course.id}/assignments/#{@assignment.id}" expect(send_broken_content!).to be true @@ -119,24 +119,24 @@ describe BrokenLinkHelper, type: :controller do end it 'should return :unpublished_item for unpublished content' do - @assignment.update_attributes(workflow_state: 'unpublished') + @assignment.update(workflow_state: 'unpublished') expect(error_type(@course, "/courses/#{@course.id}/assignments/#{@assignment.id}")).to eq :unpublished_item - quiz_model(course: @course).update_attributes(workflow_state: 'created') + quiz_model(course: @course).update(workflow_state: 'created') expect(error_type(@course, "/courses/#{@course.id}/quizzes/#{@quiz.id}")).to eq :unpublished_item - attachment_model(context: @course).update_attributes(locked: true) + attachment_model(context: @course).update(locked: true) expect(error_type(@course, "/courses/#{@course.id}/files/#{@attachment.id}/download")).to eq :unpublished_item end it 'should return :deleted for deleted content' do - @assignment.update_attributes(workflow_state: 'deleted') + @assignment.update(workflow_state: 'deleted') expect(error_type(@course, "/courses/#{@course.id}/assignments/#{@assignment.id}")).to eq :deleted - quiz_model(course: @course).update_attributes(workflow_state: 'deleted') + quiz_model(course: @course).update(workflow_state: 'deleted') expect(error_type(@course, "/courses/#{@course.id}/quizzes/#{@quiz.id}")).to eq :deleted - attachment_model(context: @course).update_attributes(file_state: 'deleted') + attachment_model(context: @course).update(file_state: 'deleted') expect(error_type(@course, "/courses/#{@course.id}/files/#{@attachment.id}/download")).to eq :deleted end diff --git a/spec/helpers/stream_items_helper_spec.rb b/spec/helpers/stream_items_helper_spec.rb index ca2dcfffc62..428196b723c 100644 --- a/spec/helpers/stream_items_helper_spec.rb +++ b/spec/helpers/stream_items_helper_spec.rb @@ -72,7 +72,7 @@ describe StreamItemsHelper do @group_assignment_discussion = group_assignment_discussion({ :course => @course }) @group_assignment_discussion.update_attribute(:user, @teacher) assignment = @group_assignment_discussion.assignment - assignment.update_attributes({ + assignment.update({ :due_at => 30.days.from_now, :lock_at => 30.days.from_now, :unlock_at => 20.days.from_now diff --git a/spec/integration/conferences_spec.rb b/spec/integration/conferences_spec.rb index 50b967d60b0..8b316cd40d1 100644 --- a/spec/integration/conferences_spec.rb +++ b/spec/integration/conferences_spec.rb @@ -75,7 +75,7 @@ describe ConferencesController, type: :request do expect(@enroll1.attributes['workflow_state']).to eq 'active' expect(@enroll2.attributes['workflow_state']).to eq 'active' - @enroll2.update_attributes('workflow_state' => 'completed') + @enroll2.update('workflow_state' => 'completed') expect(@enroll2.attributes['workflow_state']).to eq 'completed' get "/courses/#{@course.id}/conferences" diff --git a/spec/integration/context_module_spec.rb b/spec/integration/context_module_spec.rb index 8ac9067ff63..c0e97a77b51 100644 --- a/spec/integration/context_module_spec.rb +++ b/spec/integration/context_module_spec.rb @@ -51,7 +51,7 @@ describe ContextModule do get "/courses/#{@course.id}/modules" expect(response.body).to match(/My Sub Header Title/) - content_tag.update_attributes(:title => "My New Title") + content_tag.update(:title => "My New Title") get "/courses/#{@course.id}/modules" expect(response.body).to match(/My New Title/) diff --git a/spec/integration/enrollment_date_restrictions_spec.rb b/spec/integration/enrollment_date_restrictions_spec.rb index 94a8225bb90..d1aafab097c 100644 --- a/spec/integration/enrollment_date_restrictions_spec.rb +++ b/spec/integration/enrollment_date_restrictions_spec.rb @@ -32,7 +32,7 @@ describe "enrollment_date_restrictions" do @enrollment2 = course_factory(:course_name => "Course 2", :active_all => 1) - @course.update_attributes(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => true) + @course.update(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => true) e2 = student_in_course(:user => @student, :active_all => 1) expect(e1.state).to eq :active expect(e1.state_based_on_date).to eq :active diff --git a/spec/lib/api/v1/planner_item_spec.rb b/spec/lib/api/v1/planner_item_spec.rb index 30d3ec8a651..ef9171d33b0 100644 --- a/spec/lib/api/v1/planner_item_spec.rb +++ b/spec/lib/api/v1/planner_item_spec.rb @@ -367,8 +367,8 @@ describe Api::V1::PlannerItem do it 'should return true for assignments with new grades' do group_discussion_assignment graded_submission(@quiz, @student) - graded_submission_model(assignment: @assignment, user: @student).update_attributes(score: 5) - graded_submission_model(assignment: @topic.assignment, user: @student).update_attributes(score: 5) + graded_submission_model(assignment: @assignment, user: @student).update(score: 5) + graded_submission_model(assignment: @topic.assignment, user: @student).update(score: 5) expect(api.planner_item_json(@quiz, @student, session)[:new_activity]).to be true expect(api.planner_item_json(@assignment, @student, session)[:new_activity]).to be true expect(api.planner_item_json(@topic, @student, session)[:new_activity]).to be true @@ -433,7 +433,7 @@ describe Api::V1::PlannerItem do it "links to a graded discussion topic's submission if appropriate" do group_discussion_assignment expect(api.planner_item_json(@topic.assignment, @student, session)[:html_url]).to eq 'named_context_url' - graded_submission_model(assignment: @topic.assignment, user: @student).update_attributes(score: 5) + graded_submission_model(assignment: @topic.assignment, user: @student).update(score: 5) expect(api.planner_item_json(@topic.assignment, @student, session)[:html_url]).to eq 'course_assignment_submission_url' end end diff --git a/spec/lib/api/v1/sis_assignment_spec.rb b/spec/lib/api/v1/sis_assignment_spec.rb index b9c1d2ca275..915485baaf0 100644 --- a/spec/lib/api/v1/sis_assignment_spec.rb +++ b/spec/lib/api/v1/sis_assignment_spec.rb @@ -192,7 +192,7 @@ describe Api::V1::SisAssignment do context "mastery paths overrides" do it "uses a mastery paths due date as the course due date" do due_at = Time.zone.parse('2017-02-08 22:11:10') - assignment_1.update_attributes(due_at: nil) + assignment_1.update(due_at: nil) create_mastery_paths_override_for_assignment(assignment_1, due_at: due_at) assignments = Assignment.where(id: assignment_1.id). preload(:active_assignment_overrides) @@ -204,7 +204,7 @@ describe Api::V1::SisAssignment do it "prefers the assignment due_at over an override" do assignment_due_at = Time.zone.parse('2017-03-08 22:11:10') - assignment_1.update_attributes(due_at: assignment_due_at) + assignment_1.update(due_at: assignment_due_at) override_due_at = Time.zone.parse('2017-02-08 22:11:10') create_mastery_paths_override_for_assignment(assignment_1, due_at: override_due_at) diff --git a/spec/lib/canvas/live_events_spec.rb b/spec/lib/canvas/live_events_spec.rb index 6d1d1514305..c08e24c0122 100644 --- a/spec/lib/canvas/live_events_spec.rb +++ b/spec/lib/canvas/live_events_spec.rb @@ -520,7 +520,7 @@ describe Canvas::LiveEvents do end it 'should include the group_id if assignment is a group assignment' do - submission.update_attributes(group: group) + submission.update(group: group) expect_event('submission_created', hash_including( @@ -543,7 +543,7 @@ describe Canvas::LiveEvents do end it 'should include the group_id if assignment is a group assignment' do - submission.update_attributes(group: group) + submission.update(group: group) expect_event('submission_updated', hash_including( @@ -585,7 +585,7 @@ describe Canvas::LiveEvents do end it 'should include the group_id if assignment is a group assignment' do - submission.update_attributes(group: group) + submission.update(group: group) expect_event('plagiarism_resubmit', hash_including( diff --git a/spec/lib/content_zipper_spec.rb b/spec/lib/content_zipper_spec.rb index f75835be6b1..3ccfeca721c 100644 --- a/spec/lib/content_zipper_spec.rb +++ b/spec/lib/content_zipper_spec.rb @@ -94,7 +94,7 @@ describe ContentZipper do it "should ignore undownloadable submissions" do course_with_student(active_all: true) - @user.update_attributes!(sortable_name: 'some_999_, _1234_guy') + @user.update!(sortable_name: 'some_999_, _1234_guy') assignment_model(course: @course) @assignment.submission_types="online_text_entry,media_recording" @assignment.save @@ -121,7 +121,7 @@ describe ContentZipper do it "should zip up online_url submissions" do course_with_student(active_all: true) - @user.update_attributes!(sortable_name: 'some_999_, _1234_guy') + @user.update!(sortable_name: 'some_999_, _1234_guy') submission_model user: @user attachment = Attachment.new(display_name: 'my_download.zip') attachment.user = @teacher diff --git a/spec/lib/course_link_validator_spec.rb b/spec/lib/course_link_validator_spec.rb index f4978fab707..c5c591d25f9 100644 --- a/spec/lib/course_link_validator_spec.rb +++ b/spec/lib/course_link_validator_spec.rb @@ -428,13 +428,13 @@ describe CourseLinkValidator do @assignment.unpublish! expect(@course_link_validator.check_object_status("/courses/#{@course.id}/assignments/#{@assignment.id}")).to eq :unpublished_item - quiz_model(course: @course).update_attributes(workflow_state: 'created') + quiz_model(course: @course).update(workflow_state: 'created') expect(@course_link_validator.check_object_status("/courses/#{@course.id}/quizzes/#{@quiz.id}")).to eq :unpublished_item quiz_model(course: @course).unpublish! expect(@course_link_validator.check_object_status("/courses/#{@course.id}/quizzes/#{@quiz.id}")).to eq :unpublished_item - attachment_model(context: @course).update_attributes(locked: true) + attachment_model(context: @course).update(locked: true) expect(@course_link_validator.check_object_status("/courses/#{@course.id}/files/#{@attachment.id}/download")).to eq :unpublished_item end diff --git a/spec/lib/data_fixup/lti/update_custom_params_spec.rb b/spec/lib/data_fixup/lti/update_custom_params_spec.rb index 934b6d2729b..f4bc5011811 100644 --- a/spec/lib/data_fixup/lti/update_custom_params_spec.rb +++ b/spec/lib/data_fixup/lti/update_custom_params_spec.rb @@ -64,7 +64,7 @@ describe 'UpdateCustomParams' do course_model @root_account = @course.root_account @account = account_model(:root_account => @root_account, :parent_account => @root_account) - @course.update_attributes!(account: @account) + @course.update!(account: @account) @to_process_url = 'tool.instructure.com' @unprocessed_url = 'some_other_tool.instructure.com' @subdomain_url = 'subdomain.tool.instructure.com' diff --git a/spec/lib/due_date_cacher_spec.rb b/spec/lib/due_date_cacher_spec.rb index e9ec90ea5d1..0aa33698701 100644 --- a/spec/lib/due_date_cacher_spec.rb +++ b/spec/lib/due_date_cacher_spec.rb @@ -571,7 +571,7 @@ describe DueDateCacher do student2 = user_factory @course.enroll_student(student2, enrollment_state: 'active') submission2 = submission_model(assignment: @assignment, user: student2) - submission2.update_attributes(cached_due_date: nil) + submission2.update(cached_due_date: nil) student2.enrollments.find_by(course: @course).conclude DueDateCacher.new(@course, [@assignment]).recompute @@ -625,7 +625,7 @@ describe DueDateCacher do student2 = user_factory @course.enroll_student(student2, enrollment_state: 'active') submission2 = submission_model(assignment: @assignment, user: student2) - submission2.update_attributes(cached_due_date: nil) + submission2.update(cached_due_date: nil) student2.enrollments.find_by(course: @course).conclude DueDateCacher.new(@course, [@assignment]).recompute diff --git a/spec/lib/grade_calculator_spec.rb b/spec/lib/grade_calculator_spec.rb index 7d7fbf1731d..af74562e741 100644 --- a/spec/lib/grade_calculator_spec.rb +++ b/spec/lib/grade_calculator_spec.rb @@ -369,7 +369,7 @@ describe GradeCalculator do expect(enrollment.computed_final_score).to equal 20.0 - a2.update_attributes assignment_group: ag1 + a2.update assignment_group: ag1 expect(enrollment.reload.computed_final_score).to equal 50.0 end diff --git a/spec/lib/gradebook/final_grade_overrides_spec.rb b/spec/lib/gradebook/final_grade_overrides_spec.rb index c652577784f..3294562f9a5 100644 --- a/spec/lib/gradebook/final_grade_overrides_spec.rb +++ b/spec/lib/gradebook/final_grade_overrides_spec.rb @@ -97,19 +97,19 @@ describe Gradebook::FinalGradeOverrides do it "includes scores for invited students" do @student_enrollment_1.scores.find_by!(course_score: true).update!(override_score: 89.1) - @student_enrollment_1.update_attributes(workflow_state: "invited", last_activity_at: nil) + @student_enrollment_1.update(workflow_state: "invited", last_activity_at: nil) expect(final_grade_overrides[@student_1.id][:course_grade][:percentage]).to equal(89.1) end it "includes scores for test students" do @test_student_enrollment.scores.find_by!(course_score: true).update!(override_score: 89.1) - @test_student_enrollment.update_attributes(workflow_state: "invited", last_activity_at: nil) + @test_student_enrollment.update(workflow_state: "invited", last_activity_at: nil) expect(final_grade_overrides[@test_student.id][:course_grade][:percentage]).to equal(89.1) end it "excludes scores for deleted students" do @student_enrollment_1.scores.find_by!(course_score: true).update!(override_score: 89.1) - @student_enrollment_1.update_attributes(workflow_state: "deleted") + @student_enrollment_1.update(workflow_state: "deleted") expect(final_grade_overrides).not_to have_key(@student_1.id) end diff --git a/spec/lib/gradebook_exporter_spec.rb b/spec/lib/gradebook_exporter_spec.rb index b88772c490b..847299392b6 100644 --- a/spec/lib/gradebook_exporter_spec.rb +++ b/spec/lib/gradebook_exporter_spec.rb @@ -570,7 +570,7 @@ describe GradebookExporter do context "with weighted assignment groups" do before(:once) do student_in_course active_all: true - @course.update_attributes(group_weighting_scheme: 'percent') + @course.update(group_weighting_scheme: 'percent') first_group = @course.assignment_groups.create!(name: "First Group", group_weight: 0.5) @course.assignment_groups.create!(name: "Second Group", group_weight: 0.5) diff --git a/spec/lib/lti/messages/resource_link_request_spec.rb b/spec/lib/lti/messages/resource_link_request_spec.rb index a87f87ba6ec..f6f2c3f0fd3 100644 --- a/spec/lib/lti/messages/resource_link_request_spec.rb +++ b/spec/lib/lti/messages/resource_link_request_spec.rb @@ -135,7 +135,7 @@ describe Lti::Messages::ResourceLinkRequest do let(:api_message) { 'Assignment not configured for external tool launches' } before do - assignment.update_attributes!(submission_types: 'none') + assignment.update!(submission_types: 'none') end it_behaves_like 'launch error check' @@ -157,7 +157,7 @@ describe Lti::Messages::ResourceLinkRequest do let(:api_message) { 'Assignment not configured for launches with specified tool' } before do - assignment.update_attributes!(external_tool_tag_attributes: { content: different_tool }) + assignment.update!(external_tool_tag_attributes: { content: different_tool }) end it_behaves_like 'launch error check' @@ -167,7 +167,7 @@ describe Lti::Messages::ResourceLinkRequest do let(:api_message) { 'Mismatched assignment vs resource link tool configurations' } before do - assignment.line_items.find(&:assignment_line_item?).resource_link.update_attributes!(context_external_tool: different_tool) + assignment.line_items.find(&:assignment_line_item?).resource_link.update!(context_external_tool: different_tool) end it_behaves_like 'launch error check' diff --git a/spec/lib/lti/permission_checker_spec.rb b/spec/lib/lti/permission_checker_spec.rb index 1280eb662a5..fa7db4a0af3 100644 --- a/spec/lib/lti/permission_checker_spec.rb +++ b/spec/lib/lti/permission_checker_spec.rb @@ -55,7 +55,7 @@ describe Lti::PermissionChecker do let(:other_tp) do other_tp = tool_proxy.dup - other_tp.update_attributes(guid: SecureRandom.uuid, context: course) + other_tp.update(guid: SecureRandom.uuid, context: course) allow(other_tp).to receive(:active_in_context?) { true } allow(other_tp).to receive(:resources) { [double(message_handlers: [ message_handler ])] } other_tp @@ -75,7 +75,7 @@ describe Lti::PermissionChecker do it "returns false if the requesting tool does not have the same access as the associated tool" do allow(other_tp).to receive(:resources).and_call_original other_tp.raw_data['tool_profile']['product_instance']['product_info']['product_family']['code'] = 'different' - other_tp.update_attributes(guid: SecureRandom.uuid, context: course) + other_tp.update(guid: SecureRandom.uuid, context: course) allow(other_tp).to receive(:active_in_context?) { true } expect(Lti::PermissionChecker.authorized_lti2_action?(tool: other_tp, context: assignment)).to eq false end diff --git a/spec/lib/lti/variable_expander_spec.rb b/spec/lib/lti/variable_expander_spec.rb index 1e3e0b5630e..2dc6d0dbbed 100644 --- a/spec/lib/lti/variable_expander_spec.rb +++ b/spec/lib/lti/variable_expander_spec.rb @@ -402,14 +402,14 @@ module Lti end it 'has a substitution for com.instructure.Assignment.lti.id when there is no tool setting' do - assignment.update_attributes(context: course) + assignment.update(context: course) variable_expander = VariableExpander.new(root_account, account, controller, current_user: user, tool: tool, assignment: assignment) - assignment.update_attributes(context: course) + assignment.update(context: course) exp_hash = {test: '$com.instructure.Assignment.lti.id'} variable_expander.expand_variables!(exp_hash) expect(exp_hash[:test]).to eq assignment.lti_context_id @@ -768,8 +768,8 @@ module Lti end before do - group.update_attributes!(users: [user]) - new_assignment.update_attributes!(group_category: group_category) + group.update!(users: [user]) + new_assignment.update!(group_category: group_category) end shared_examples 'a safe expansion when assignment is blank' do diff --git a/spec/lib/permissions_helper_spec.rb b/spec/lib/permissions_helper_spec.rb index c34f126b6b1..a166b716a55 100644 --- a/spec/lib/permissions_helper_spec.rb +++ b/spec/lib/permissions_helper_spec.rb @@ -371,7 +371,7 @@ describe PermissionsHelper do concluded_teacher_term = Account.default.enrollment_terms.create!(:name => "concluded") concluded_teacher_term.set_overrides(Account.default, 'TeacherEnrollment' => { start_at: '2014-12-01', end_at: '2014-12-31' }) concluded_teacher_enrollment = course_with_teacher(user: @user, active_all: true) - @course.update_attributes(:enrollment_term => concluded_teacher_term) + @course.update(:enrollment_term => concluded_teacher_term) expect(@user.precalculate_permissions_for_courses([@course], [:manage_calendar])).to eq({ concluded_teacher_enrollment.global_course_id => {:manage_calendar => false, :read => true, :read_as_admin => true} @@ -463,14 +463,14 @@ describe PermissionsHelper do it "should work with concluded-available permissions" do RoleOverride.create!(permission: 'moderate_forum', enabled: true, role: student_role, account: Account.default) concluded_student_enrollment = course_with_student(:active_all => true) - @course.update_attributes(:start_at => 1.month.ago, :conclude_at => 2.weeks.ago, :restrict_enrollments_to_course_dates => true) + @course.update(:start_at => 1.month.ago, :conclude_at => 2.weeks.ago, :restrict_enrollments_to_course_dates => true) expect(concluded_student_enrollment.reload).to be_completed concluded_teacher_term = Account.default.enrollment_terms.create!(:name => "concluded") concluded_teacher_term.set_overrides(Account.default, 'TeacherEnrollment' => { start_at: '2014-12-01', end_at: '2014-12-31' }) concluded_teacher_enrollment = course_with_teacher(:user => @user, :active_all => true) - @course.update_attributes(:enrollment_term => concluded_teacher_term) + @course.update(:enrollment_term => concluded_teacher_term) expect(concluded_teacher_enrollment.reload).to be_completed active_student_enrollment = course_with_student(:user => @user, :active_all => true) diff --git a/spec/lib/sis/csv/section_importer_spec.rb b/spec/lib/sis/csv/section_importer_spec.rb index a7082afc0d0..fc45501908e 100644 --- a/spec/lib/sis/csv/section_importer_spec.rb +++ b/spec/lib/sis/csv/section_importer_spec.rb @@ -111,7 +111,7 @@ describe SIS::CSV::SectionImporter do it 'should not error trying to restore a deleted default_section' do course = @account.courses.create!(:sis_source_id => "C001") section = course.default_section - section.update_attributes(:sis_source_id => "S001", :workflow_state => "deleted") + section.update(:sis_source_id => "S001", :workflow_state => "deleted") new_section = course.course_sections.create!(:default_section => true) process_csv_data_cleanly( "section_id,course_id,name,status", diff --git a/spec/lib/support_helpers/crocodoc_spec.rb b/spec/lib/support_helpers/crocodoc_spec.rb index b1c55912c71..7243623b937 100644 --- a/spec/lib/support_helpers/crocodoc_spec.rb +++ b/spec/lib/support_helpers/crocodoc_spec.rb @@ -59,17 +59,17 @@ describe SupportHelpers::Crocodoc::CrocodocFixer do let!(:crocodocument) do cd = shardattachment.create_crocodoc_document - cd.update_attributes(uuid: 'some stuff', process_state: 'ERROR') + cd.update(uuid: 'some stuff', process_state: 'ERROR') cd end let!(:crocodocument2) do cd = shardattachment2.create_crocodoc_document - cd.update_attributes(uuid: 'some stuff', process_state: 'ERROR') + cd.update(uuid: 'some stuff', process_state: 'ERROR') cd end let!(:crocodocument3) do cd = shardattachment3.create_crocodoc_document - cd.update_attributes(uuid: 'some stuff', process_state: 'PROCESSING') + cd.update(uuid: 'some stuff', process_state: 'PROCESSING') cd end @@ -111,7 +111,7 @@ describe SupportHelpers::Crocodoc::CrocodocFixer do end it 'resubmits processing crodocodcs if stuck for more than a day' do - crocodocument3.update_attributes(updated_at: 4.days.ago) + crocodocument3.update(updated_at: 4.days.ago) fixer = SupportHelpers::Crocodoc::SubmissionFixer.new('email', nil, assignment2.id, student.id) diff --git a/spec/lib/turnitin_spec.rb b/spec/lib/turnitin_spec.rb index 5a27028e85f..6b1b51ce104 100644 --- a/spec/lib/turnitin_spec.rb +++ b/spec/lib/turnitin_spec.rb @@ -131,7 +131,7 @@ describe Turnitin::Client do :exclude_type => '1', :exclude_value => '5' } - @assignment.update_attributes(:turnitin_settings => @sample_turnitin_settings) + @assignment.update(:turnitin_settings => @sample_turnitin_settings) end it "marks assignment as created and current on success" do @@ -171,7 +171,7 @@ describe Turnitin::Client do it "sets s_view_report to 0 if originality_report_visibility is 'never'" do @sample_turnitin_settings[:originality_report_visibility] = 'never' - @assignment.update_attributes(:turnitin_settings => @sample_turnitin_settings) + @assignment.update(:turnitin_settings => @sample_turnitin_settings) stub_net_http_to_return('12345') @assignment.create_in_turnitin diff --git a/spec/lib/user_search_spec.rb b/spec/lib/user_search_spec.rb index fe44f8f5f57..d86f1a7268d 100644 --- a/spec/lib/user_search_spec.rb +++ b/spec/lib/user_search_spec.rb @@ -255,7 +255,7 @@ describe UserSearch do end it 'will not match channels where the type is not email' do - cc.update_attributes!(:path_type => CommunicationChannel::TYPE_TWITTER) + cc.update!(:path_type => CommunicationChannel::TYPE_TWITTER) expect(UserSearch.for_user_in_context("the.giver", course, user)).to eq [] end diff --git a/spec/messages/new_discussion_topic.erb_spec.rb b/spec/messages/new_discussion_topic.erb_spec.rb index 609b438ec17..3d10ebf931a 100644 --- a/spec/messages/new_discussion_topic.erb_spec.rb +++ b/spec/messages/new_discussion_topic.erb_spec.rb @@ -30,7 +30,7 @@ describe 'new_discussion_topic' do include_examples "a message" context "locked discussions" do it "should send locked notification if availibility date is locked for email" do - @topic.update_attributes( + @topic.update( unlock_at: Time.zone.now + 3.days, lock_at: Time.zone.now + 6.days, message: "the content here of the discussion body" @@ -41,7 +41,7 @@ describe 'new_discussion_topic' do end it "should send discussion notification with discussions content when unlocked for email" do - @topic.update_attributes( + @topic.update( unlock_at: nil, lock_at: nil, message: "the content here of the discussion body" @@ -52,7 +52,7 @@ describe 'new_discussion_topic' do end it "should send locked notification if availibility date is locked for sms" do - @topic.update_attributes( + @topic.update( unlock_at: Time.zone.now + 3.days, lock_at: Time.zone.now + 6.days, message: "the content here of the discussion body" @@ -63,7 +63,7 @@ describe 'new_discussion_topic' do end it "should send discussion notification with discussions content when unlocked sms" do - @topic.update_attributes( + @topic.update( unlock_at: nil, lock_at: nil, message: "the content here of the discussion body" @@ -74,7 +74,7 @@ describe 'new_discussion_topic' do end it "should send locked notification if availibility date is locked for summary" do - @topic.update_attributes( + @topic.update( unlock_at: Time.zone.now + 3.days, lock_at: Time.zone.now + 6.days, message: "the content here of the discussion body" @@ -85,7 +85,7 @@ describe 'new_discussion_topic' do end it "should send discussion notification with discussions content when unlocked summary" do - @topic.update_attributes( + @topic.update( unlock_at: nil, lock_at: nil, message: "the content here of the discussion body" diff --git a/spec/messages/updated_wiki_page.erb_spec.rb b/spec/messages/updated_wiki_page.erb_spec.rb index 1f5c7ab1332..88e84cb29b6 100644 --- a/spec/messages/updated_wiki_page.erb_spec.rb +++ b/spec/messages/updated_wiki_page.erb_spec.rb @@ -36,11 +36,11 @@ describe "updated_wiki_page" do context_module.add_item({:id => page.id, :type => 'wiki_page'}) page.reload - context_module.update_attributes( + context_module.update( unlock_at: Time.zone.now + 3.days ) - page.update_attributes( + page.update( body: "the content here of the Wiki Page body", could_be_locked: true ) @@ -56,11 +56,11 @@ describe "updated_wiki_page" do context_module.add_item({:id => page.id, :type => 'wiki_page'}) page.reload - context_module.update_attributes( + context_module.update( unlock_at: Time.zone.now - 3.days ) - page.update_attributes( + page.update( body: "the content here of the Wiki Page body", could_be_locked: true ) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 4cba092f2a5..d6cac14f5ee 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -961,7 +961,7 @@ describe Account do describe "fast_all_users" do it "should preserve sortable_name" do user_with_pseudonym(:active_all => 1) - @user.update_attributes(:name => "John St. Clair", :sortable_name => "St. Clair, John") + @user.update(:name => "John St. Clair", :sortable_name => "St. Clair, John") @johnstclair = @user user_with_pseudonym(:active_all => 1, :username => 'jt@instructure.com', :name => 'JT Olds') @jtolds = @user diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb index 1565185a3cf..8f74ad76b0f 100644 --- a/spec/models/announcement_spec.rb +++ b/spec/models/announcement_spec.rb @@ -234,7 +234,7 @@ describe Announcement do section2 = @course.course_sections.create! other_student = user_factory(:active_all => true) @course.enroll_student(other_student, :section => section2, :enrollment_state => 'active') - section2.update_attributes(:start_at => 2.months.ago, :end_at => 1.month.ago, :restrict_enrollments_to_section_dates => true) + section2.update(:start_at => 2.months.ago, :end_at => 1.month.ago, :restrict_enrollments_to_section_dates => true) notification_name = "New Announcement" n = Notification.create(:name => notification_name, :category => "TestImmediately") diff --git a/spec/models/appointment_group_spec.rb b/spec/models/appointment_group_spec.rb index 6b5f59465f3..0075012b467 100644 --- a/spec/models/appointment_group_spec.rb +++ b/spec/models/appointment_group_spec.rb @@ -164,23 +164,23 @@ describe AppointmentGroup do end it "should allow additional appointments" do - expect(@ag.update_attributes(:new_appointments => [['2012-01-01 13:00:00', '2012-01-01 14:00:00']])).to be_truthy + expect(@ag.update(:new_appointments => [['2012-01-01 13:00:00', '2012-01-01 14:00:00']])).to be_truthy expect(@ag.appointments.size).to eql 2 end it "should not allow invalid appointments" do - expect(@ag.update_attributes(:new_appointments => [['2012-01-01 14:00:00', '2012-01-01 13:00:00']])).to be_falsey + expect(@ag.update(:new_appointments => [['2012-01-01 14:00:00', '2012-01-01 13:00:00']])).to be_falsey end it "should not allow overlapping appointments" do - expect(@ag.update_attributes(:new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']])).to be_falsey + expect(@ag.update(:new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']])).to be_falsey end it "should update start_at/end_at when adding appointments" do expect(@ag.start_at).to eql @ag.appointments.map(&:start_at).min expect(@ag.end_at).to eql @ag.appointments.map(&:end_at).max - expect(@ag.update_attributes(:new_appointments => [ + expect(@ag.update(:new_appointments => [ ['2012-01-01 17:00:00', '2012-01-01 18:00:00'], ['2012-01-01 07:00:00', '2012-01-01 08:00:00'] ])).to be_truthy @@ -389,7 +389,7 @@ describe AppointmentGroup do it "should notify all participants when adding appointments", priority: "1", test_id: 193138 do @ag.publish! - @ag.update_attributes(:new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']]) + @ag.update(:new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']]) expect(@ag.messages_sent).to be_include("Appointment Group Updated") expect(@ag.messages_sent["Appointment Group Updated"].map(&:user_id).sort.uniq).to eql [@student.id, @observer.id].sort end @@ -453,12 +453,12 @@ describe AppointmentGroup do end it "should be nil if participants_per_appointment is nil" do - @ag.update_attributes :participants_per_appointment => nil + @ag.update :participants_per_appointment => nil expect(@ag.available_slots).to be_nil end it "should change if participants_per_appointment changes" do - @ag.update_attributes :participants_per_appointment => 1 + @ag.update :participants_per_appointment => 1 expect(@ag.available_slots).to eql 2 end @@ -466,12 +466,12 @@ describe AppointmentGroup do @appointment.reserve_for(student_in_course(:course => @course, :active_all => true).user, @teacher) @appointment.reserve_for(student_in_course(:course => @course, :active_all => true).user, @teacher) expect(@ag.reload.available_slots).to eql 2 - @ag.update_attributes :participants_per_appointment => 1 + @ag.update :participants_per_appointment => 1 expect(@ag.reload.available_slots).to eql 1 end it "should increase as appointments are added" do - @ag.update_attributes(:new_appointments => [["#{Time.now.year + 1}-01-01 14:00:00", "#{Time.now.year + 1}-01-01 15:00:00"]]) + @ag.update(:new_appointments => [["#{Time.now.year + 1}-01-01 14:00:00", "#{Time.now.year + 1}-01-01 15:00:00"]]) expect(@ag.available_slots).to eql 6 end diff --git a/spec/models/assignment_configuration_tool_lookup_spec.rb b/spec/models/assignment_configuration_tool_lookup_spec.rb index 69681885e60..cafe0b655bd 100644 --- a/spec/models/assignment_configuration_tool_lookup_spec.rb +++ b/spec/models/assignment_configuration_tool_lookup_spec.rb @@ -30,7 +30,7 @@ describe AssignmentConfigurationToolLookup do allow(subscription_service).to receive_messages(create_tool_proxy_subscription: stub_response) allow(subscription_service).to receive_messages(destroy_tool_proxy_subscription: stub_response) - message_handler.update_attributes(capabilities: ["Canvas.placements.similarityDetection"]) + message_handler.update(capabilities: ["Canvas.placements.similarityDetection"]) resource_handler.message_handlers << message_handler tool_proxy.resources << resource_handler @@ -214,17 +214,17 @@ describe AssignmentConfigurationToolLookup do describe '#configured_assignments' do it 'finds configured assignments when installed in an account' do - tool_proxy.update_attributes!(context: account) + tool_proxy.update!(context: account) expect(AssignmentConfigurationToolLookup.by_tool_proxy(tool_proxy)).to match_array [assignment] end it 'finds configured assignments when installed in a root acocunt' do - tool_proxy.update_attributes!(context: root_account) + tool_proxy.update!(context: root_account) expect(AssignmentConfigurationToolLookup.by_tool_proxy(tool_proxy)).to match_array [assignment] end it 'finds configured assignments when installed in a course' do - tool_proxy.update_attributes!(context: course) + tool_proxy.update!(context: course) expect(AssignmentConfigurationToolLookup.by_tool_proxy(tool_proxy)).to match_array [assignment] end @@ -233,7 +233,7 @@ describe AssignmentConfigurationToolLookup do second_assignment.tool_settings_tool = message_handler second_assignment.lti_context_id = SecureRandom.uuid second_assignment.save! - tool_proxy.update_attributes!(context: root_account) + tool_proxy.update!(context: root_account) expect(AssignmentConfigurationToolLookup.by_tool_proxy(tool_proxy)).to match_array [assignment, second_assignment] end end diff --git a/spec/models/assignment_group_spec.rb b/spec/models/assignment_group_spec.rb index 511aa8a8560..c58b1efe9d0 100644 --- a/spec/models/assignment_group_spec.rb +++ b/spec/models/assignment_group_spec.rb @@ -198,7 +198,7 @@ describe AssignmentGroup do context "when the assignment is due in a closed grading period" do before(:once) do - @assignment.update_attributes(due_at: 4.weeks.ago) + @assignment.update(due_at: 4.weeks.ago) end it "is true for admins" do @@ -212,7 +212,7 @@ describe AssignmentGroup do context "when the assignment is due in an open grading period" do before(:once) do - @assignment.update_attributes(due_at: 2.weeks.ago) + @assignment.update(due_at: 2.weeks.ago) end it "is true for admins" do @@ -226,7 +226,7 @@ describe AssignmentGroup do context "when the assignment is due after all grading periods" do before(:once) do - @assignment.update_attributes(due_at: 1.day.from_now) + @assignment.update(due_at: 1.day.from_now) end it "is true for admins" do @@ -240,7 +240,7 @@ describe AssignmentGroup do context "when the assignment is due before all grading periods" do before(:once) do - @assignment.update_attributes(due_at: 6.weeks.ago) + @assignment.update(due_at: 6.weeks.ago) end it "is true for admins" do @@ -254,7 +254,7 @@ describe AssignmentGroup do context "when the assignment has no due date" do before(:once) do - @assignment.update_attributes(due_at: nil) + @assignment.update(due_at: nil) end it "is true for admins" do @@ -268,7 +268,7 @@ describe AssignmentGroup do context "when the assignment is due in a closed grading period for a student" do before(:once) do - @assignment.update_attributes(due_at: 2.days.from_now) + @assignment.update(due_at: 2.days.from_now) override = @assignment.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -286,7 +286,7 @@ describe AssignmentGroup do context "when the assignment is overridden with no due date for a student" do before(:once) do - @assignment.update_attributes(due_at: nil) + @assignment.update(due_at: nil) override = @assignment.assignment_overrides.build override.set = @course.default_section override.save! @@ -303,7 +303,7 @@ describe AssignmentGroup do context "when the assignment is deleted and due in a closed grading period" do before(:once) do - @assignment.update_attributes(due_at: 4.weeks.ago) + @assignment.update(due_at: 4.weeks.ago) @assignment.destroy end @@ -318,7 +318,7 @@ describe AssignmentGroup do context "when the quiz is due in a closed grading period" do before(:once) do - @quiz.update_attributes(due_at: 4.weeks.ago) + @quiz.update(due_at: 4.weeks.ago) end it "is true for admins" do @@ -332,7 +332,7 @@ describe AssignmentGroup do context "when the quiz is due in an open grading period" do before(:once) do - @quiz.update_attributes(due_at: 2.weeks.ago) + @quiz.update(due_at: 2.weeks.ago) end it "is true for admins" do @@ -346,7 +346,7 @@ describe AssignmentGroup do context "when the quiz is due after all grading periods" do before(:once) do - @quiz.update_attributes(due_at: 1.day.from_now) + @quiz.update(due_at: 1.day.from_now) end it "is true for admins" do @@ -360,7 +360,7 @@ describe AssignmentGroup do context "when the quiz is due before all grading periods" do before(:once) do - @quiz.update_attributes(due_at: 6.weeks.ago) + @quiz.update(due_at: 6.weeks.ago) end it "is true for admins" do @@ -374,7 +374,7 @@ describe AssignmentGroup do context "when the quiz has no due date" do before(:once) do - @quiz.update_attributes(due_at: nil) + @quiz.update(due_at: nil) end it "is true for admins" do @@ -388,7 +388,7 @@ describe AssignmentGroup do context "when the quiz is due in a closed grading period for a student" do before(:once) do - @quiz.update_attributes(due_at: 2.days.from_now) + @quiz.update(due_at: 2.days.from_now) override = @quiz.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -406,7 +406,7 @@ describe AssignmentGroup do context "when the quiz is overridden with no due date for a student" do before(:once) do - @quiz.update_attributes(due_at: nil) + @quiz.update(due_at: nil) override = @quiz.assignment_overrides.build override.set = @course.default_section override.save! @@ -423,7 +423,7 @@ describe AssignmentGroup do context "when the quiz is deleted and due in a closed grading period" do before(:once) do - @quiz.update_attributes(due_at: 4.weeks.ago) + @quiz.update(due_at: 4.weeks.ago) @quiz.destroy end diff --git a/spec/models/assignment_spec.rb b/spec/models/assignment_spec.rb index a98a59dd874..e9a688e1717 100644 --- a/spec/models/assignment_spec.rb +++ b/spec/models/assignment_spec.rb @@ -1057,7 +1057,7 @@ describe Assignment do it 'returns the name of the tool proxy' do expected_name = 'test name' - message_handler.tool_proxy.update_attributes!(name: expected_name) + message_handler.tool_proxy.update!(name: expected_name) setup_assignment_with_homework course.assignments << @assignment @assignment.tool_settings_tool = message_handler @@ -3227,7 +3227,7 @@ describe Assignment do context "when assignment is anonymously graded" do before :once do - @assignment.update_attributes(moderated_grading: true, anonymous_grading: true, grader_count: 1) + @assignment.update(moderated_grading: true, anonymous_grading: true, grader_count: 1) @assignment.mute! end @@ -3265,7 +3265,7 @@ describe Assignment do context "when assignment is anonymously graded and not moderated" do before :once do - @assignment.update_attributes(moderated_grading: false, anonymous_grading: true) + @assignment.update(moderated_grading: false, anonymous_grading: true) @assignment.mute! end @@ -3281,7 +3281,7 @@ describe Assignment do context "when assignment is not anonymously graded" do before :once do - @assignment.update_attributes(moderated_grading: true, anonymous_grading: false, grader_count: 1) + @assignment.update(moderated_grading: true, anonymous_grading: false, grader_count: 1) @assignment.mute! end @@ -3737,7 +3737,7 @@ describe Assignment do it "should not assign peer reviews to members of the same group when disabled" do @submissions = [] gc = @course.group_categories.create! name: "Groupy McGroupface" - @a.update_attributes group_category_id: gc.id, + @a.update group_category_id: gc.id, grade_group_students_individually: false users = create_users_in_course(@course, 8.times.map{ |i| {name: "user #{i}"} }, return_type: :record) ["group_1", "group_2"].each do |group_name| @@ -3755,7 +3755,7 @@ describe Assignment do it "should assign peer reviews to members of the same group when enabled" do @submissions = [] gc = @course.group_categories.create! name: "Groupy McGroupface" - @a.update_attributes group_category_id: gc.id, + @a.update group_category_id: gc.id, grade_group_students_individually: false users = create_users_in_course(@course, 8.times.map{ |i| {name: "user #{i}"} }, return_type: :record) ["group_1", "group_2"].each do |group_name| @@ -4092,7 +4092,7 @@ describe Assignment do context "letter grades" do before :once do - @assignment.update_attributes(:grading_type => 'letter_grade', :points_possible => 20) + @assignment.update(:grading_type => 'letter_grade', :points_possible => 20) end it "should update grades when assignment changes" do @@ -4121,7 +4121,7 @@ describe Assignment do context "gpa scale grades" do before :once do - @assignment.update_attributes(:grading_type => 'gpa_scale', :points_possible => 20) + @assignment.update(:grading_type => 'gpa_scale', :points_possible => 20) @course.grading_standards.build({title: "GPA"}) gs = @course.grading_standards.last gs.data = {"4.0" => 0.94, @@ -4213,7 +4213,7 @@ describe Assignment do context "when the assignment is due in a closed grading period" do before(:once) do - @assignment.update_attributes(due_at: 4.weeks.ago) + @assignment.update(due_at: 4.weeks.ago) end it "is true for admins" do @@ -4227,7 +4227,7 @@ describe Assignment do context "when the assignment is due in an open grading period" do before(:once) do - @assignment.update_attributes(due_at: 2.weeks.ago) + @assignment.update(due_at: 2.weeks.ago) end it "is true for admins" do @@ -4241,7 +4241,7 @@ describe Assignment do context "when the assignment is due after all grading periods" do before(:once) do - @assignment.update_attributes(due_at: 1.day.from_now) + @assignment.update(due_at: 1.day.from_now) end it "is true for admins" do @@ -4255,7 +4255,7 @@ describe Assignment do context "when the assignment is due before all grading periods" do before(:once) do - @assignment.update_attributes(due_at: 6.weeks.ago) + @assignment.update(due_at: 6.weeks.ago) end it "is true for admins" do @@ -4269,7 +4269,7 @@ describe Assignment do context "when the assignment has no due date" do before(:once) do - @assignment.update_attributes(due_at: nil) + @assignment.update(due_at: nil) end it "is true for admins" do @@ -4283,7 +4283,7 @@ describe Assignment do context "when the assignment is due in a closed grading period for a student" do before(:once) do - @assignment.update_attributes(due_at: 2.days.from_now) + @assignment.update(due_at: 2.days.from_now) override = @assignment.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -4301,7 +4301,7 @@ describe Assignment do context "when the assignment is overridden with no due date for a student" do before(:once) do - @assignment.update_attributes(due_at: nil) + @assignment.update(due_at: nil) override = @assignment.assignment_overrides.build override.set = @course.default_section override.save! @@ -4318,7 +4318,7 @@ describe Assignment do context "when the assignment has a deleted override in a closed grading period for a student" do before(:once) do - @assignment.update_attributes(due_at: 2.days.from_now) + @assignment.update(due_at: 2.days.from_now) override = @assignment.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -4337,7 +4337,7 @@ describe Assignment do context "when the assignment is overridden with no due date and is only visible to overrides" do before(:once) do - @assignment.update_attributes(due_at: 4.weeks.ago, only_visible_to_overrides: true) + @assignment.update(due_at: 4.weeks.ago, only_visible_to_overrides: true) override = @assignment.assignment_overrides.build override.set = @course.default_section override.save! @@ -4985,7 +4985,7 @@ describe Assignment do expect(@sub2.messages_sent['Submission Graded']).to be_present expect(@sub2.messages_sent['Submission Graded'].first.from_name).to eq @course.name expect(@sub2.messages_sent['Submission Grade Changed']).to be_nil - @sub2.update_attributes(:graded_at => Time.zone.now - 60*60) + @sub2.update(:graded_at => Time.zone.now - 60*60) @sub2 = @assignment.grade_student(@stu2, grade: 9, grader: @teacher).first expect(@sub2.messages_sent).not_to be_empty expect(@sub2.messages_sent['Submission Graded']).to be_nil @@ -5017,7 +5017,7 @@ describe Assignment do it "should not notify students when their grade is changed if muted" do @sub2 = @assignment.grade_student(@stu2, grade: 8, grader: @teacher).first - @sub2.update_attributes(:graded_at => Time.zone.now - 60*60) + @sub2.update(:graded_at => Time.zone.now - 60*60) @sub2 = @assignment.grade_student(@stu2, grade: 9, grader: @teacher).first expect(@sub2.messages_sent).to be_empty end @@ -6519,7 +6519,7 @@ describe Assignment do s1, s2 = @students gc = @course.group_categories.create! name: "Homework Groups" - @assignment.update_attributes group_category_id: gc.id, + @assignment.update group_category_id: gc.id, grade_group_students_individually: false g1, g2 = 2.times.map { |i| gc.groups.create! name: "Group #{i}", context: @course } g1.add_user(s1) @@ -8792,7 +8792,7 @@ describe Assignment do score_maximum: previous_points_possible, resource_link: first_line_item.resource_link ) - line_item_two.update_attributes!(created_at: first_line_item.created_at + 1.minute) + line_item_two.update!(created_at: first_line_item.created_at + 1.minute) assignment.title += " edit" assignment.points_possible += 10 assignment.save! diff --git a/spec/models/calendar_event_spec.rb b/spec/models/calendar_event_spec.rb index bc88301e4ef..8ffbb629a43 100644 --- a/spec/models/calendar_event_spec.rb +++ b/spec/models/calendar_event_spec.rb @@ -100,14 +100,14 @@ describe CalendarEvent do it "should retain all day flag when date is changed (calls :default_values)" do # Flag the event as all day - @event.update_attributes({ :start_at => @original_start_at, :end_at => @original_end_at, :all_day => true }) + @event.update({ :start_at => @original_start_at, :end_at => @original_end_at, :all_day => true }) expect(@event.all_day?).to be_truthy expect(@event.all_day_date.strftime("%Y-%m-%d")).to eq "2008-09-03" expect(@event.zoned_start_at.strftime("%H:%M")).to eq "00:00" expect(@event.end_at).to eql(@event.zoned_start_at) # Change the date but keep the all day flag as true - @event.update_attributes({ :start_at => @event.start_at - 1.day, :end_at => @event.end_at - 1.day, :all_day => true }) + @event.update({ :start_at => @event.start_at - 1.day, :end_at => @event.end_at - 1.day, :all_day => true }) expect(@event.all_day?).to be_truthy expect(@event.all_day_date.strftime("%Y-%m-%d")).to eq "2008-09-02" expect(@event.zoned_start_at.strftime("%H:%M")).to eq "00:00" @@ -130,12 +130,12 @@ describe CalendarEvent do it "should not retain all day flag when times are changed (calls :default_values)" do # set the start and end to midnight and make sure all_day is automatically set - @event.update_attributes({ :start_at => @midnight, :end_at => @midnight }) + @event.update({ :start_at => @midnight, :end_at => @midnight }) expect(@event.all_day?).to be_truthy expect(@event.all_day_date.strftime("%Y-%m-%d")).to eq "2008-09-03" # set the start and end to different times and then make sure all_day is automatically unset - @event.update_attributes({ :start_at => @original_start_at, :end_at => @original_end_at }) + @event.update({ :start_at => @original_start_at, :end_at => @original_end_at }) expect(@event.all_day?).to be_falsey end end @@ -409,7 +409,7 @@ describe CalendarEvent do context "with event date edited" do before :once do - @event1.update_attributes(start_at: Time.now, end_at: Time.now) + @event1.update(start_at: Time.now, end_at: Time.now) end context "edit notification" do @@ -763,7 +763,7 @@ describe CalendarEvent do end it "should copy changed group attributes to existing appointments" do - @ag.update_attributes(:title => 'changed!', :description => "test\n123") + @ag.update(:title => 'changed!', :description => "test\n123") e = @ag.appointments.first.reload expect(e.title).to eql 'changed!' expect(e.description).to eql "test
\r\n123" @@ -782,7 +782,7 @@ describe CalendarEvent do it "should copy the group attributes to subsequent appointments" do ag = AppointmentGroup.create(:title => "test", :contexts => [@course]) - ag.update_attributes( + ag.update( :title => 'haha', :new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']] ) @@ -791,7 +791,7 @@ describe CalendarEvent do end it "should ignore changes to locked attributes on the appointment" do - @appointment.update_attributes(:start_at => '2012-01-01 12:30:00', :title => 'you wish') + @appointment.update(:start_at => '2012-01-01 12:30:00', :title => 'you wish') expect(@appointment.title).to eql 'test' expect(@appointment.start_at).to eql Time.parse('2012-01-01 12:30:00Z') end @@ -905,7 +905,7 @@ describe CalendarEvent do e1.reload events1 = e1.child_events.sort_by(&:id) - e1.update_attributes :child_event_data => [ + e1.update :child_event_data => [ {:start_at => "2012-01-01 13:00:00", :end_at => "2012-01-01 14:00:00", :context_code => @course.default_section.asset_string}, {:start_at => "2012-01-02 12:00:00", :end_at => "2012-01-02 13:00:00", :context_code => s3.asset_string}, ] @@ -946,7 +946,7 @@ describe CalendarEvent do e1.updating_user = @user e1.save! e1.reload - e1.update_attributes :remove_child_events => true + e1.update :remove_child_events => true expect(e1.child_events.reload).to be_empty end end diff --git a/spec/models/content_migration/course_copy_assignments_spec.rb b/spec/models/content_migration/course_copy_assignments_spec.rb index a188479504b..1683c649a39 100644 --- a/spec/models/content_migration/course_copy_assignments_spec.rb +++ b/spec/models/content_migration/course_copy_assignments_spec.rb @@ -749,11 +749,11 @@ describe ContentMigration do allow(Lti::ToolProxy).to receive(:find_active_proxies_for_context_by_vendor_code_and_product_code) do Lti::ToolProxy.where(id: tool_proxy.id) end - product_family.update_attributes!( + product_family.update!( product_code: 'product_code', vendor_code: 'vendor_code' ) - tool_proxy.update_attributes!( + tool_proxy.update!( resources: [resource_handler], context: @copy_to ) diff --git a/spec/models/content_migration/course_copy_discussions_spec.rb b/spec/models/content_migration/course_copy_discussions_spec.rb index e8cc49d4b52..28e742d989d 100644 --- a/spec/models/content_migration/course_copy_discussions_spec.rb +++ b/spec/models/content_migration/course_copy_discussions_spec.rb @@ -317,7 +317,7 @@ describe ContentMigration do it "should not apply the late policy right away if shifting dates to the future" do graded_discussion_topic(context: @copy_from) - @assignment.update_attributes(:due_at => 3.days.ago, :points_possible => 4) + @assignment.update(:due_at => 3.days.ago, :points_possible => 4) [@copy_from, @copy_to].each do |course| course.create_late_policy(missing_submission_deduction_enabled: true, missing_submission_deduction: 25.0) diff --git a/spec/models/context_module_progression_spec.rb b/spec/models/context_module_progression_spec.rb index 2b381de0e92..6faa385aa8e 100644 --- a/spec/models/context_module_progression_spec.rb +++ b/spec/models/context_module_progression_spec.rb @@ -375,7 +375,7 @@ describe ContextModuleProgression do expect(progression).to be_unlocked quiz_sub = quiz.generate_submission(@user) - quiz_sub.update_attributes(:score => 100, :workflow_state => 'complete', :submission_data => nil) + quiz_sub.update(:score => 100, :workflow_state => 'complete', :submission_data => nil) quiz_sub.with_versioning(&:save) expect(progression.reload).to be_started diff --git a/spec/models/context_module_spec.rb b/spec/models/context_module_spec.rb index 3c97f3594fa..5fe26719e7c 100644 --- a/spec/models/context_module_spec.rb +++ b/spec/models/context_module_spec.rb @@ -423,7 +423,7 @@ describe ContextModule do end it 'adds the item in the correct position when the existing items have duplicate positions' do - @module.content_tags.find_by(title: 'two').update_attributes(position: 1) + @module.content_tags.find_by(title: 'two').update(position: 1) @module.insert_items([@attach, @assign], 2) expect(@module.content_tags.find_by(position: 2).title).to eq @attach.title expect(@module.content_tags.find_by(position: 3).title).to eq @assign.title diff --git a/spec/models/context_spec.rb b/spec/models/context_spec.rb index fdaa6f47af1..264fdd400c0 100644 --- a/spec/models/context_spec.rb +++ b/spec/models/context_spec.rb @@ -144,7 +144,7 @@ describe Context do end it 'should find files' do - attachment_model(context: @course).update_attributes(locked: true) + attachment_model(context: @course).update(locked: true) expect(Context.find_asset_by_url("/courses/#{@course.id}/files?preview=#{@attachment.id}")).to eq @attachment expect(Context.find_asset_by_url("/courses/#{@course.id}/files/#{@attachment.id}/download?wrap=1")).to eq @attachment expect(Context.find_asset_by_url("/courses/#{@course.id}/file_contents/course%20files//#{@attachment.name}")).to eq @attachment diff --git a/spec/models/conversation_participant_spec.rb b/spec/models/conversation_participant_spec.rb index e651cec3dce..41f2f5f24bb 100644 --- a/spec/models/conversation_participant_spec.rb +++ b/spec/models/conversation_participant_spec.rb @@ -103,17 +103,17 @@ describe ConversationParticipant do expect(conversation.starred).to be_falsey end - it "should support :starred in update_attributes" do + it "should support :starred in update" do sender = user_factory recipient = user_factory conversation = sender.initiate_conversation([recipient]) - conversation.update_attributes(:starred => true) + conversation.update(:starred => true) conversation.save conversation.reload expect(conversation.starred).to be_truthy - conversation.update_attributes(:starred => false) + conversation.update(:starred => false) conversation.save conversation.reload expect(conversation.starred).to be_falsey diff --git a/spec/models/conversation_spec.rb b/spec/models/conversation_spec.rb index ce2906f2dda..6eb01242679 100644 --- a/spec/models/conversation_spec.rb +++ b/spec/models/conversation_spec.rb @@ -281,7 +281,7 @@ describe Conversation do @subscribed_guy.conversations.first.update_attribute(:workflow_state, "read") expect(@subscribed_guy.reload.unread_conversations_count).to eql 0 expect(@subscribed_guy.conversations.unread.size).to eql 0 - @unsubscribed_guy.conversations.first.update_attributes(:subscribed => false) + @unsubscribed_guy.conversations.first.update(:subscribed => false) expect(@unsubscribed_guy.reload.unread_conversations_count).to eql 0 expect(@unsubscribed_guy.conversations.unread.size).to eql 0 @@ -361,11 +361,11 @@ describe Conversation do expect(subscription_guy.reload.unread_conversations_count).to eql 1 expect(subscription_guy.conversations.unread.size).to eql 1 - subscription_guy.conversations.first.update_attributes(:subscribed => false) + subscription_guy.conversations.first.update(:subscribed => false) expect(subscription_guy.reload.unread_conversations_count).to eql 0 expect(subscription_guy.conversations.unread.size).to eql 0 - archive_guy.conversations.first.update_attributes(:workflow_state => "archived", :subscribed => false) + archive_guy.conversations.first.update(:workflow_state => "archived", :subscribed => false) expect(archive_guy.conversations.archived.size).to eql 1 end @@ -376,23 +376,23 @@ describe Conversation do root_convo = Conversation.initiate([sender, flip_flopper_guy, archive_guy, subscription_guy], false) root_convo.add_message(sender, 'test') - flip_flopper_guy.conversations.first.update_attributes(:subscribed => false) + flip_flopper_guy.conversations.first.update(:subscribed => false) expect(flip_flopper_guy.reload.unread_conversations_count).to eql 0 expect(flip_flopper_guy.conversations.unread.size).to eql 0 # no new messages in the interim, he should stay "marked-as-read" - flip_flopper_guy.conversations.first.update_attributes(:subscribed => true) + flip_flopper_guy.conversations.first.update(:subscribed => true) expect(flip_flopper_guy.reload.unread_conversations_count).to eql 0 expect(flip_flopper_guy.conversations.unread.size).to eql 0 - subscription_guy.conversations.first.update_attributes(:subscribed => false) - archive_guy.conversations.first.update_attributes(:workflow_state => "archived", :subscribed => false) + subscription_guy.conversations.first.update(:subscribed => false) + archive_guy.conversations.first.update(:workflow_state => "archived", :subscribed => false) message = root_convo.add_message(sender, 'you wish you were subscribed!') message.update_attribute(:created_at, Time.now.utc + 1.minute) last_message_at = message.reload.created_at - subscription_guy.conversations.first.update_attributes(:subscribed => true) - archive_guy.conversations.first.update_attributes(:subscribed => true) + subscription_guy.conversations.first.update(:subscribed => true) + archive_guy.conversations.first.update(:subscribed => true) expect(subscription_guy.reload.unread_conversations_count).to eql 1 expect(subscription_guy.conversations.unread.size).to eql 1 @@ -521,7 +521,7 @@ describe Conversation do recipient = recipients.last rconvo = recipient.conversations.first expect(rconvo.unread?).to be_truthy - rconvo.update_attributes(:subscribed => false) + rconvo.update(:subscribed => false) expect(rconvo.unread?).to be_falsey convo = sender.conversations.first @@ -529,7 +529,7 @@ describe Conversation do message.update_attribute(:created_at, Time.now.utc + 1.minute) expect(rconvo.reload.unread?).to be_falsey - rconvo.update_attributes(:subscribed => true) + rconvo.update(:subscribed => true) expect(rconvo.unread?).to be_truthy end diff --git a/spec/models/course_date_range_spec.rb b/spec/models/course_date_range_spec.rb index 8d0bd940855..c27221d1330 100644 --- a/spec/models/course_date_range_spec.rb +++ b/spec/models/course_date_range_spec.rb @@ -29,7 +29,7 @@ describe CourseDateRange do end it "should get term dates if restrict enrollments to course dates is false" do - @course.enrollment_term.update_attributes(start_at: Time.now - 10.days, end_at: Time.now + 10.days) + @course.enrollment_term.update(start_at: Time.now - 10.days, end_at: Time.now + 10.days) range = CourseDateRange.new(@course) expect(range.start_at[:date_context]).to eq("term") expect(range.end_at[:date_context]).to eq("term") @@ -40,7 +40,7 @@ describe CourseDateRange do describe "with restrict enrollments to course dates active" do it "should set the range based on the course" do - @course.update_attributes(start_at: Time.now - 5.days, conclude_at: Time.now + 5.days, restrict_enrollments_to_course_dates: true) + @course.update(start_at: Time.now - 5.days, conclude_at: Time.now + 5.days, restrict_enrollments_to_course_dates: true) range = CourseDateRange.new(@course) expect(range.start_at[:date_context]).to eq("course") expect(range.end_at[:date_context]).to eq("course") @@ -49,7 +49,7 @@ describe CourseDateRange do end it "should fall back to term date range if no range exists for the course" do - @course.update_attributes(start_at: nil, conclude_at: nil) + @course.update(start_at: nil, conclude_at: nil) range = CourseDateRange.new(@course) expect(range.start_at[:date_context]).to eq("term") expect(range.end_at[:date_context]).to eq("term") diff --git a/spec/models/course_section_spec.rb b/spec/models/course_section_spec.rb index 9c3ed70d4d3..e9a4e65403f 100644 --- a/spec/models/course_section_spec.rb +++ b/spec/models/course_section_spec.rb @@ -539,12 +539,12 @@ describe CourseSection, "moving to new course" do end it "should invalidate access if section is cross-listed" do - @course.update_attributes(:workflow_state => "available", :restrict_student_future_view => true, + @course.update(:workflow_state => "available", :restrict_student_future_view => true, :restrict_enrollments_to_course_dates => true, :start_at => 1.day.from_now) expect(@enrollment.enrollment_state.reload.restricted_access?).to eq true other_course = course_factory(active_all: true) - other_course.update_attributes(:restrict_enrollments_to_course_dates => true, :start_at => 1.day.from_now) + other_course.update(:restrict_enrollments_to_course_dates => true, :start_at => 1.day.from_now) @section.crosslist_to_course(other_course) diff --git a/spec/models/course_spec.rb b/spec/models/course_spec.rb index b06dd61dabb..1d46ab022f2 100644 --- a/spec/models/course_spec.rb +++ b/spec/models/course_spec.rb @@ -392,7 +392,7 @@ describe Course do context "without term end date" do it "should know if it has been soft-concluded" do - @course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) + @course.update({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) expect(@course).not_to be_soft_concluded @course.update_attribute(:conclude_at, 1.week.from_now) @@ -409,7 +409,7 @@ describe Course do end it "should know if it has been soft-concluded" do - @course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) + @course.update({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) expect(@course).to be_soft_concluded @course.update_attribute(:conclude_at, 1.week.from_now) @@ -426,7 +426,7 @@ describe Course do end it "should know if it has been soft-concluded" do - @course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) + @course.update({:conclude_at => nil, :restrict_enrollments_to_course_dates => true }) expect(@course).not_to be_soft_concluded @course.update_attribute(:conclude_at, 1.week.from_now) @@ -2603,7 +2603,7 @@ describe Course, "tabs_available" do context "a public course" do before :once do - course_factory(active_all: true).update_attributes(:is_public => true, :indexed => true) + course_factory(active_all: true).update(:is_public => true, :indexed => true) @course.announcements.create!(:title => 'Title', :message => 'Message') default_group = @course.root_outcome_group outcome = @course.created_learning_outcomes.create!(:title => 'outcome') @@ -4610,14 +4610,14 @@ describe Course, "student_view_student" do end it "should give fake student active student permissions even if enrollment wouldn't otherwise be active" do - @course.enrollment_term.update_attributes(:start_at => 2.days.from_now, :end_at => 4.days.from_now) + @course.enrollment_term.update(:start_at => 2.days.from_now, :end_at => 4.days.from_now) @fake_student = @course.student_view_student expect(@course.grants_right?(@fake_student, nil, :read_forum)).to be_truthy end it "should not update the fake student's enrollment state to 'invited' in a concluded course" do @course.student_view_student - @course.enrollment_term.update_attributes(:start_at => 4.days.ago, :end_at => 2.days.ago) + @course.enrollment_term.update(:start_at => 4.days.ago, :end_at => 2.days.ago) @fake_student = @course.student_view_student expect(@fake_student.enrollments.where(course_id: @course).map(&:workflow_state)).to eql(['active']) end diff --git a/spec/models/crocodoc_document_spec.rb b/spec/models/crocodoc_document_spec.rb index 559acf853cf..e1c82cdf6cc 100644 --- a/spec/models/crocodoc_document_spec.rb +++ b/spec/models/crocodoc_document_spec.rb @@ -107,7 +107,7 @@ describe 'CrocodocDocument' do end it "should not allow annotations if anonymous_peer_reviews" do - @submission.assignment.update_attributes anonymous_peer_reviews: true, + @submission.assignment.update anonymous_peer_reviews: true, peer_reviews: true expect(@crocodoc.permissions_for_user(@student)).to eq({ :filter => 'none', diff --git a/spec/models/discussion_topic_spec.rb b/spec/models/discussion_topic_spec.rb index e8f794eff84..097f6b7accd 100644 --- a/spec/models/discussion_topic_spec.rb +++ b/spec/models/discussion_topic_spec.rb @@ -542,7 +542,7 @@ describe DiscussionTopic do group_category = @course.group_categories.create(:name => "new cat") @group = @course.groups.create(:name => "group", :group_category => group_category) @group.add_user(@student1) - @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) @topic = @group.discussion_topics.create(:title => "group topic") @topic.save! @@ -555,8 +555,8 @@ describe DiscussionTopic do group_category = @course.group_categories.create(:name => "new cat") @group = @course.groups.create(:name => "group", :group_category => group_category) @group.add_user(@student1) - @course.update_attributes(:start_at => 2.days.ago, :conclude_at => 1.day.ago, :restrict_enrollments_to_course_dates => true) - @section.update_attributes(:start_at => 2.days.ago, :end_at => 2.days.from_now, + @course.update(:start_at => 2.days.ago, :conclude_at => 1.day.ago, :restrict_enrollments_to_course_dates => true) + @section.update(:start_at => 2.days.ago, :end_at => 2.days.from_now, :restrict_enrollments_to_section_dates => true) @topic = @group.discussion_topics.create(:title => "group topic") @topic.save! @@ -1943,7 +1943,7 @@ describe DiscussionTopic do reply = @topic.reply_from(:user => @user, :text => "ohai") run_jobs expect(Delayed::Job.strand_size("materialized_discussion:#{@topic.id}")).to eq 0 - reply.update_attributes(:message => "i got that wrong before") + reply.update(:message => "i got that wrong before") expect(Delayed::Job.strand_size("materialized_discussion:#{@topic.id}")).to eq 1 end @@ -2332,12 +2332,12 @@ describe DiscussionTopic do end it 'returns student entries if specified' do - @topic.update_attributes(podcast_has_student_posts: true) + @topic.update(podcast_has_student_posts: true) expect(@topic.entries_for_feed(@student, true)).to match_array([@entry1, @entry2]) end it 'only returns admin entries if specified' do - @topic.update_attributes(podcast_has_student_posts: false) + @topic.update(podcast_has_student_posts: false) expect(@topic.entries_for_feed(@student, true)).to match_array([@entry1]) end @@ -2346,7 +2346,7 @@ describe DiscussionTopic do membership = group_with_user(group_category: @group_category, user: @student) @topic = @group.discussion_topics.create(title: "group topic", user: @teacher) @topic.discussion_entries.create(message: "some message", user: @student) - @topic.update_attributes(podcast_has_student_posts: false) + @topic.update(podcast_has_student_posts: false) expect(@topic.entries_for_feed(@student, true)).to_not be_empty end end diff --git a/spec/models/folder_spec.rb b/spec/models/folder_spec.rb index dbb81684d8d..ff57875856d 100644 --- a/spec/models/folder_spec.rb +++ b/spec/models/folder_spec.rb @@ -107,7 +107,7 @@ describe Folder do it "should not allow root folders to have their names changed" do f1 = Folder.root_folders(@course).first f1.reload - f1.update_attributes(:name => "something") + f1.update(:name => "something") expect(f1.save).to eq false expect(f1.errors.detect { |e| e.first.to_s == 'name' }).to be_present end @@ -119,7 +119,7 @@ describe Folder do a.uploaded_data = default_uploaded_data a.save! nil_a = @course.attachments.new - nil_a.update_attributes(:uploaded_data => default_uploaded_data) + nil_a.update(:uploaded_data => default_uploaded_data) expect(nil_a.folder_id).not_to be_nil expect(f.active_file_attachments).to be_include(a) # f.active_file_attachments.should be_include(nil_a) @@ -131,7 +131,7 @@ describe Folder do a.uploaded_data = default_uploaded_data a.save! nil_a = @course.attachments.new - nil_a.update_attributes(:uploaded_data => default_uploaded_data) + nil_a.update(:uploaded_data => default_uploaded_data) expect(f.active_file_attachments).to be_include(a) expect(f.active_file_attachments).to be_include(nil_a) end diff --git a/spec/models/grading_standard_spec.rb b/spec/models/grading_standard_spec.rb index 07b10108298..6f5fc2fc41b 100644 --- a/spec/models/grading_standard_spec.rb +++ b/spec/models/grading_standard_spec.rb @@ -314,7 +314,7 @@ describe GradingStandard do @root_account = Account.default @sub_account = @root_account.sub_accounts.create! course_with_teacher(account: @root_account) - @enrollment.update_attributes(workflow_state: "active") + @enrollment.update(workflow_state: "active") @root_account_standard = grading_standard_for(@root_account) @sub_account_standard = grading_standard_for(@sub_account) @course_standard = grading_standard_for(@course) @@ -378,7 +378,7 @@ describe GradingStandard do @root_account = Account.default @sub_account = @root_account.sub_accounts.create! course_with_teacher(account: @sub_account) - @enrollment.update_attributes(workflow_state: "active") + @enrollment.update(workflow_state: "active") @root_account_standard = grading_standard_for(@root_account) @sub_account_standard = grading_standard_for(@sub_account) @course_standard = grading_standard_for(@course) diff --git a/spec/models/ignore_spec.rb b/spec/models/ignore_spec.rb index bffaef44a36..3f0cc071ecd 100644 --- a/spec/models/ignore_spec.rb +++ b/spec/models/ignore_spec.rb @@ -35,7 +35,7 @@ describe Ignore do describe '#cleanup' do it 'should delete ignores for deleted assignments' do - @assignment.update_attributes!(workflow_state: 'deleted', updated_at: 2.months.ago) + @assignment.update!(workflow_state: 'deleted', updated_at: 2.months.ago) assignment2 = assignment_model(course: @course) ignore2 = Ignore.create!(asset: assignment2, user: @student, purpose: 'submitting') assignment2.destroy_permanently! @@ -45,7 +45,7 @@ describe Ignore do end it 'should delete ignores for deleted quizzes' do - @quiz.update_attributes!(workflow_state: 'deleted', updated_at: 2.months.ago) + @quiz.update!(workflow_state: 'deleted', updated_at: 2.months.ago) quiz2 = quiz_model(course: @course) ignore2 = Ignore.create!(asset: quiz2, user: @student, purpose: 'submitting') quiz2.destroy_permanently! @@ -69,7 +69,7 @@ describe Ignore do end it 'should delete ignores for users with enrollments concluded for six months' do - @enrollment.update_attributes!(workflow_state: 'completed', completed_at: 7.months.ago) + @enrollment.update!(workflow_state: 'completed', completed_at: 7.months.ago) Ignore.cleanup expect {@ignore_assign.reload}.to raise_error ActiveRecord::RecordNotFound expect {@ignore_quiz.reload}.to raise_error ActiveRecord::RecordNotFound @@ -85,7 +85,7 @@ describe Ignore do end it 'should delete ignores for users with deleted enrollments' do - @enrollment.update_attributes!(workflow_state: 'deleted', updated_at: 2.months.ago) + @enrollment.update!(workflow_state: 'deleted', updated_at: 2.months.ago) Ignore.cleanup expect {@ignore_assign.reload}.to raise_error ActiveRecord::RecordNotFound expect {@ignore_quiz.reload}.to raise_error ActiveRecord::RecordNotFound diff --git a/spec/models/learning_outcome_result_spec.rb b/spec/models/learning_outcome_result_spec.rb index fe5ef608793..6b5dee3891c 100644 --- a/spec/models/learning_outcome_result_spec.rb +++ b/spec/models/learning_outcome_result_spec.rb @@ -58,7 +58,7 @@ describe LearningOutcomeResult do let_once(:assessed_at) { 2.weeks.ago } it 'returns #submitted_at when present' do - learning_outcome_result.update_attributes(submitted_at: submitted_at) + learning_outcome_result.update(submitted_at: submitted_at) expect(learning_outcome_result.submitted_or_assessed_at).to eq(submitted_at) end @@ -146,8 +146,8 @@ describe LearningOutcomeResult do describe "#calculate percent!" do it "properly calculates percent" do - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 0.60 @@ -159,8 +159,8 @@ describe LearningOutcomeResult do points_possible: points_possible, mastery_points: 3.5 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 0.6) - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! mastery_score = (learning_outcome_result.percent * points_possible).round(2) expect(mastery_score).to eq 3.5 @@ -171,8 +171,8 @@ describe LearningOutcomeResult do points_possible: 5.0, mastery_points: 3.0 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 0.7) - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 0.5143 @@ -183,8 +183,8 @@ describe LearningOutcomeResult do points_possible: 5.0, mastery_points: 3.0 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 1.0) - learning_outcome_result.update_attributes(score: 5) - learning_outcome_result.update_attributes(possible: 0.5) + learning_outcome_result.update(score: 5) + learning_outcome_result.update(possible: 0.5) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 6.0 @@ -195,8 +195,8 @@ describe LearningOutcomeResult do points_possible: 0.0, mastery_points: 3.0 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 1.0) - learning_outcome_result.update_attributes(score: 5) - learning_outcome_result.update_attributes(possible: 0.5) + learning_outcome_result.update(score: 5) + learning_outcome_result.update(possible: 0.5) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 10.0 @@ -207,8 +207,8 @@ describe LearningOutcomeResult do points_possible: 5, mastery_points: 3 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 0.7) - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 0.5143 @@ -219,8 +219,8 @@ describe LearningOutcomeResult do points_possible: 5, mastery_points: 0 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 0.7) - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 0.60 @@ -231,8 +231,8 @@ describe LearningOutcomeResult do points_possible: 0, mastery_points: 3 }) allow(learning_outcome_result.alignment).to receive_messages(mastery_score: 0.7) - learning_outcome_result.update_attributes(score: 6) - learning_outcome_result.update_attributes(possible: 10) + learning_outcome_result.update(score: 6) + learning_outcome_result.update(possible: 10) learning_outcome_result.calculate_percent! expect(learning_outcome_result.percent).to eq 0.60 diff --git a/spec/models/lti/line_item_spec.rb b/spec/models/lti/line_item_spec.rb index ed0de368e2f..c6a18899285 100644 --- a/spec/models/lti/line_item_spec.rb +++ b/spec/models/lti/line_item_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Lti::LineItem, type: :model do it 'requires "score_maximum"' do expect do - line_item.update_attributes!(score_maximum: nil) + line_item.update!(score_maximum: nil) end.to raise_error( ActiveRecord::RecordInvalid, "Validation failed: Score maximum can't be blank, Score maximum is not a number" @@ -33,13 +33,13 @@ RSpec.describe Lti::LineItem, type: :model do it 'requires "label"' do expect do - line_item.update_attributes!(label: nil) + line_item.update!(label: nil) end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Label can't be blank") end it 'requires "assignment"' do expect do - line_item.update_attributes!(assignment: nil) + line_item.update!(assignment: nil) end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Assignment can't be blank") end end @@ -56,7 +56,7 @@ RSpec.describe Lti::LineItem, type: :model do it 'returns true if the line item was created before all others in the resource' do line_item_one = line_item_model(resource_link: resource_link, assignment: assignment) line_item_two = line_item_model(resource_link: resource_link, assignment: assignment) - line_item_two.update_attributes!(created_at: line_item_one.created_at + 5.seconds) + line_item_two.update!(created_at: line_item_one.created_at + 5.seconds) expect(line_item_one.assignment_line_item?).to eq true end @@ -64,7 +64,7 @@ RSpec.describe Lti::LineItem, type: :model do it 'returns false if there is a link and the line item is not the first in the resource' do line_item_one = line_item_model(resource_link: resource_link, assignment: assignment) line_item_two = line_item_model(resource_link: resource_link, assignment: assignment) - line_item_two.update_attributes!(created_at: line_item_one.created_at + 5.seconds) + line_item_two.update!(created_at: line_item_one.created_at + 5.seconds) expect(line_item_two.assignment_line_item?).to eq false end diff --git a/spec/models/lti/link_spec.rb b/spec/models/lti/link_spec.rb index 47790c4274d..7c8e5db292c 100644 --- a/spec/models/lti/link_spec.rb +++ b/spec/models/lti/link_spec.rb @@ -66,11 +66,11 @@ module Lti let(:lti_link) { subject } 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.update_attributes(resource_type_code: resource_handler.resource_type_code, + lti_link.update(resource_type_code: resource_handler.resource_type_code, product_code: product_family.product_code, vendor_code: product_family.vendor_code) end diff --git a/spec/models/lti/lti_outbound_adapter_spec.rb b/spec/models/lti/lti_outbound_adapter_spec.rb index 2dca9f53806..084818b6682 100644 --- a/spec/models/lti/lti_outbound_adapter_spec.rb +++ b/spec/models/lti/lti_outbound_adapter_spec.rb @@ -246,7 +246,7 @@ describe Lti::LtiOutboundAdapter do end it "includes the 'ext_lti_assignment_id' if the optional assignment parameter is present" do - assignment.update_attributes(lti_context_id: SecureRandom.uuid) + assignment.update(lti_context_id: SecureRandom.uuid) adapter.prepare_tool_launch(return_url, variable_expander) payload = adapter.generate_post_payload(assignment: assignment) expect(payload['ext_lti_assignment_id']).to eq assignment.lti_context_id @@ -276,7 +276,7 @@ describe Lti::LtiOutboundAdapter do end it "includes the 'ext_lti_assignment_id' parameter" do - assignment.update_attributes(lti_context_id: SecureRandom.uuid) + assignment.update(lti_context_id: SecureRandom.uuid) adapter.prepare_tool_launch(return_url, variable_expander) expect(tool_launch).to receive(:for_assignment!).with(lti_assignment, outcome_service_url, legacy_outcome_service_url, lti_turnitin_outcomes_placement_url) payload = adapter.generate_post_payload_for_assignment(assignment, outcome_service_url, legacy_outcome_service_url, lti_turnitin_outcomes_placement_url) @@ -351,7 +351,7 @@ describe Lti::LtiOutboundAdapter do before do allow(BasicLTI::Sourcedid).to receive(:encryption_secret) {'encryption-secret-5T14NjaTbcYjc4'} allow(BasicLTI::Sourcedid).to receive(:signing_secret) {'signing-secret-vp04BNqApwdwUYPUI'} - assignment.update_attributes!( + assignment.update!( external_tool_tag: ContentTag.create!( context: assignment, content: tool, diff --git a/spec/models/lti/message_handler_spec.rb b/spec/models/lti/message_handler_spec.rb index c9d2ef349f0..a139ad1487a 100644 --- a/spec/models/lti/message_handler_spec.rb +++ b/spec/models/lti/message_handler_spec.rb @@ -233,11 +233,11 @@ 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) end it 'finds message handlers when tool is installed in current account' do - tool_proxy.update_attributes(context: account) + tool_proxy.update(context: account) mh = MessageHandler.by_resource_codes(vendor_code: jwt_body[:vendor_code], product_code: jwt_body[:product_code], resource_type_code: jwt_body[:resource_type_code], @@ -246,7 +246,7 @@ module Lti end it 'finds message handlers when tool is installed in current course' do - tool_proxy.update_attributes(context: course) + tool_proxy.update(context: course) mh = MessageHandler.by_resource_codes(vendor_code: jwt_body[:vendor_code], product_code: jwt_body[:product_code], resource_type_code: jwt_body[:resource_type_code], @@ -255,7 +255,7 @@ module Lti end it 'does not return message handlers with a different message_type' do - message_handler.update_attributes(message_type: 'banana') + message_handler.update(message_type: 'banana') mh = MessageHandler.by_resource_codes(vendor_code: jwt_body[:vendor_code], product_code: jwt_body[:product_code], resource_type_code: jwt_body[:resource_type_code], @@ -265,8 +265,8 @@ module Lti context 'account chain search' do it 'finds message handlers when tool is installed in course root account' do - course.update_attributes(root_account: account) - tool_proxy.update_attributes(context: account) + course.update(root_account: account) + tool_proxy.update(context: account) mh = MessageHandler.by_resource_codes(vendor_code: jwt_body[:vendor_code], product_code: jwt_body[:product_code], resource_type_code: jwt_body[:resource_type_code], @@ -276,7 +276,7 @@ module Lti it 'finds message handlers when tool is installed in account root account' do root_account = Account.create! - account.update_attributes(root_account: root_account) + account.update(root_account: root_account) mh = MessageHandler.by_resource_codes(vendor_code: jwt_body[:vendor_code], product_code: jwt_body[:product_code], resource_type_code: jwt_body[:resource_type_code], diff --git a/spec/models/lti/product_family_spec.rb b/spec/models/lti/product_family_spec.rb index 4a585ed57d8..873dc527c9c 100644 --- a/spec/models/lti/product_family_spec.rb +++ b/spec/models/lti/product_family_spec.rb @@ -58,7 +58,7 @@ module Lti it 'requires unique productcode,vendorcode,rootaccount,developerkey combo' do dev_key = DeveloperKey.create(api_key:'testapikey') - subject.update_attributes(developer_key: dev_key, root_account: account) + subject.update(developer_key: dev_key, root_account: account) dup_subject = subject.dup dup_subject.save expect(dup_subject.errors.first).to eq [:product_code, "has already been taken"] diff --git a/spec/models/lti/resource_handler_spec.rb b/spec/models/lti/resource_handler_spec.rb index 3ce29318308..e2bac7f161e 100644 --- a/spec/models/lti/resource_handler_spec.rb +++ b/spec/models/lti/resource_handler_spec.rb @@ -47,8 +47,8 @@ module Lti let(:message_type) { 'custom-message-type' } before do - message_handler.update_attributes(message_type: message_type) - resource_handler.update_attributes(message_handlers: [message_handler]) + message_handler.update(message_type: message_type) + resource_handler.update(message_handlers: [message_handler]) end it 'returns the message handler with the specified type' do @@ -56,13 +56,13 @@ module Lti end it 'does not return messages with a different type' do - message_handler.update_attributes(message_type: 'different-type') + message_handler.update(message_type: 'different-type') expect(resource_handler.find_message_by_type(message_type)).to be_nil end end describe '#self.by_product_family' do - before { resource_handler.update_attributes(tool_proxy: tool_proxy) } + before { resource_handler.update(tool_proxy: tool_proxy) } it 'returns resource handlers with specified product family and context' do resource_handlers = ResourceHandler.by_product_family([product_family], tool_proxy.context) @@ -71,7 +71,7 @@ module Lti it 'does not return resource handlers with different product family' do pf = product_family.dup - pf.update_attributes(product_code: SecureRandom.uuid) + pf.update(product_code: SecureRandom.uuid) resource_handlers = ResourceHandler.by_product_family([pf], tool_proxy.context) expect(resource_handlers).not_to include resource_handler end diff --git a/spec/models/lti/result_spec.rb b/spec/models/lti/result_spec.rb index 93de8ec41f4..e27fbffa0a7 100644 --- a/spec/models/lti/result_spec.rb +++ b/spec/models/lti/result_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Lti::Result, type: :model do it 'requires "line_item"' do expect do - result.update_attributes!(line_item: nil) + result.update!(line_item: nil) end.to raise_error( ActiveRecord::RecordInvalid, "Validation failed: Line item can't be blank" @@ -35,7 +35,7 @@ RSpec.describe Lti::Result, type: :model do it 'requires "user"' do expect do - result.update_attributes!(user: nil) + result.update!(user: nil) end.to raise_error( ActiveRecord::RecordInvalid, "Validation failed: User can't be blank" @@ -44,7 +44,7 @@ RSpec.describe Lti::Result, type: :model do it 'requires the "activity_progress" be valid' do expect do - result.update_attributes!(activity_progress: 'Banana') + result.update!(activity_progress: 'Banana') end.to raise_error( ActiveRecord::RecordInvalid, "Validation failed: Activity progress is not included in the list" @@ -53,7 +53,7 @@ RSpec.describe Lti::Result, type: :model do it 'requires the "grading_progress" be valid' do expect do - result.update_attributes!(grading_progress: 'Banana') + result.update!(grading_progress: 'Banana') end.to raise_error( ActiveRecord::RecordInvalid, "Validation failed: Grading progress is not included in the list" diff --git a/spec/models/lti/tool_proxy_service_spec.rb b/spec/models/lti/tool_proxy_service_spec.rb index e9d993d375f..a1cc36bdc57 100644 --- a/spec/models/lti/tool_proxy_service_spec.rb +++ b/spec/models/lti/tool_proxy_service_spec.rb @@ -426,7 +426,7 @@ module Lti let(:assignment) { course.assignments.create!(name: 'banana') } let(:assignment_two) do assignment_two = assignment.dup - assignment_two.update_attributes(lti_context_id: SecureRandom.uuid) + assignment_two.update(lti_context_id: SecureRandom.uuid) assignment_two end let(:subscription_id) { SecureRandom.uuid } diff --git a/spec/models/lti/tool_proxy_spec.rb b/spec/models/lti/tool_proxy_spec.rb index c566b3bf5d2..c810df36936 100644 --- a/spec/models/lti/tool_proxy_spec.rb +++ b/spec/models/lti/tool_proxy_spec.rb @@ -356,7 +356,7 @@ module Lti let(:placement) { ResourcePlacement::SIMILARITY_DETECTION_LTI2 } it 'returns true when tool proxy root contains the enabled capability' do - message_handler.update_attributes!(capabilities: []) + message_handler.update!(capabilities: []) tool_proxy.raw_data['enabled_capability'] = [placement] tool_proxy.save! expect(ToolProxy.capability_enabled_in_context?(course, placement)).to be_truthy @@ -365,12 +365,12 @@ module Lti it 'returns true when the message handler contains the enabled capability' do tool_proxy.raw_data['enabled_capability'] = [] tool_proxy.save! - message_handler.update_attributes!(capabilities: [placement]) + message_handler.update!(capabilities: [placement]) expect(ToolProxy.capability_enabled_in_context?(course, placement)).to be_truthy end it 'returns false when the placement is not in the root or message handlers' do - message_handler.update_attributes!(capabilities: []) + message_handler.update!(capabilities: []) tool_proxy.raw_data['enabled_capability'] = [] tool_proxy.save! expect(ToolProxy.capability_enabled_in_context?(course, placement)).to be_falsey diff --git a/spec/models/lti/tool_setting_spec.rb b/spec/models/lti/tool_setting_spec.rb index 555dc66992a..bd996828047 100644 --- a/spec/models/lti/tool_setting_spec.rb +++ b/spec/models/lti/tool_setting_spec.rb @@ -71,11 +71,11 @@ module Lti let(:tool_setting) { subject } 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! - tool_setting.update_attributes(resource_type_code: resource_handler.resource_type_code, + tool_setting.update(resource_type_code: resource_handler.resource_type_code, product_code: product_family.product_code, vendor_code: product_family.vendor_code) end diff --git a/spec/models/master_courses/master_migration_spec.rb b/spec/models/master_courses/master_migration_spec.rb index 152de8688c3..f33e54dc025 100644 --- a/spec/models/master_courses/master_migration_spec.rb +++ b/spec/models/master_courses/master_migration_spec.rb @@ -1037,8 +1037,8 @@ describe MasterCourses::MasterMigration do cq2 = @copy_to.quizzes.where(migration_id: mig_id(quiz2)).first Timecop.travel(5.minutes.from_now) do - cq1.update_attributes(:unlock_at => dates2[0], :due_at => dates2[1], :lock_at => dates2[2]) - cq2.update_attributes(:unlock_at => dates2[0], :due_at => dates2[1], :lock_at => dates2[2], :ip_filter => '10.0.0.1/24', :hide_correct_answers_at => 1.week.from_now) + cq1.update(:unlock_at => dates2[0], :due_at => dates2[1], :lock_at => dates2[2]) + cq2.update(:unlock_at => dates2[0], :due_at => dates2[1], :lock_at => dates2[2], :ip_filter => '10.0.0.1/24', :hide_correct_answers_at => 1.week.from_now) end Timecop.travel(10.minutes.from_now) do @@ -1072,7 +1072,7 @@ describe MasterCourses::MasterMigration do Timecop.travel(5.minutes.from_now) do @template.content_tag_for(assmt).update_attribute(:restrictions, {:availability_dates => true, :due_dates => true}) - assmt.update_attributes(:due_at => nil, :unlock_at => nil, :lock_at => nil) + assmt.update(:due_at => nil, :unlock_at => nil, :lock_at => nil) end Timecop.travel(10.minutes.from_now) do @@ -1287,7 +1287,7 @@ describe MasterCourses::MasterMigration do expect(@copy_to.conclude_at).to_not be_nil Timecop.freeze(1.minute.from_now) do - @copy_from.update_attributes(:start_at => nil, :conclude_at => nil) + @copy_from.update(:start_at => nil, :conclude_at => nil) end run_master_migration(:copy_settings => true) # selective with settings expect(@copy_to.reload.start_at).to be_nil # remove the dates @@ -1296,7 +1296,7 @@ describe MasterCourses::MasterMigration do it "should be able to disable grading standard" do gs = @copy_from.grading_standards.create!(:title => "Standard eh", :data => [["Eh", 0.93], ["Eff", 0]]) - @copy_from.update_attributes(:grading_standard_enabled => true, :grading_standard => gs) + @copy_from.update(:grading_standard_enabled => true, :grading_standard => gs) @copy_to = course_factory @sub = @template.add_child_course!(@copy_to) @@ -1358,7 +1358,7 @@ describe MasterCourses::MasterMigration do @page_copy = @copy_to.wiki_pages.where(:migration_id => mig_id(@page)).first Timecop.freeze(30.seconds.from_now) do - @page_copy.update_attributes(:title => "other title", :url => "other-url") + @page_copy.update(:title => "other title", :url => "other-url") @page_copy.set_as_front_page! @page.update_attribute(:body , "beep") end @@ -1379,7 +1379,7 @@ describe MasterCourses::MasterMigration do run_master_migration Timecop.freeze(10.seconds.from_now) do - @page.update_attributes(:title => "new title", :url => "new_url") + @page.update(:title => "new title", :url => "new_url") @page.set_as_front_page! # change the url but keep as front page end @@ -1392,7 +1392,7 @@ describe MasterCourses::MasterMigration do @copy_to.wiki.unset_front_page! # set downstream change Timecop.freeze(20.seconds.from_now) do - @page.update_attributes(:title => "another new title", :url => "another_new_url") + @page.update(:title => "another new title", :url => "another_new_url") @page.set_as_front_page! end @@ -1471,7 +1471,7 @@ describe MasterCourses::MasterMigration do run_master_migration end - master_parent_folder.update_attributes(:name => "parent RENAMED", :locked => true) + master_parent_folder.update(:name => "parent RENAMED", :locked => true) master_parent_folder.sub_folders.create!(:name => "empty", :context => @copy_from) run_master_migration @@ -1513,7 +1513,7 @@ describe MasterCourses::MasterMigration do [topic, normal_assmt].each do |c| Timecop.freeze(3.seconds.from_now) do - @template.content_tag_for(c).update_attributes(:restrictions => {:content => true, :availability_dates => true}) # tightening the restrictions should touch it by default + @template.content_tag_for(c).update(:restrictions => {:content => true, :availability_dates => true}) # tightening the restrictions should touch it by default end end @@ -2148,7 +2148,7 @@ describe MasterCourses::MasterMigration do tool = @copy_to.context_external_tools.create!(:name => 'some tool', :consumer_key => 'test_key', :shared_secret => 'test_secret', :url => 'http://example.com/launch') - a_to.update_attributes(:submission_types => 'external_tool', :external_tool_tag_attributes => {:content => tool}) + a_to.update(:submission_types => 'external_tool', :external_tool_tag_attributes => {:content => tool}) tag = a_to.external_tool_tag run_master_migration diff --git a/spec/models/master_courses/master_template_spec.rb b/spec/models/master_courses/master_template_spec.rb index b78ad875ec6..93799033065 100644 --- a/spec/models/master_courses/master_template_spec.rb +++ b/spec/models/master_courses/master_template_spec.rb @@ -214,7 +214,7 @@ describe MasterCourses::MasterTemplate do end it "should touch content when tightening default_restrictions_by_type" do - @template.update_attributes(:use_default_restrictions_by_type => true, + @template.update(:use_default_restrictions_by_type => true, :default_restrictions_by_type => { 'Assignment' => {:content => true, :points => true}, 'DiscussionTopic' => {:content => true}, @@ -230,7 +230,7 @@ describe MasterCourses::MasterTemplate do @template.create_content_tag_for!(obj, :use_default_restrictions => true) end end - @template.update_attributes(:default_restrictions_by_type => { + @template.update(:default_restrictions_by_type => { 'Assignment' => {:content => true}, # lessened restrictions 'DiscussionTopic' => {:content => true, :points => true}, 'Quizzes::Quiz' => {:content => true, :due_dates => true} diff --git a/spec/models/moderated_grading/provisional_grade_spec.rb b/spec/models/moderated_grading/provisional_grade_spec.rb index fb099d5364b..c1f4d2f407d 100644 --- a/spec/models/moderated_grading/provisional_grade_spec.rb +++ b/spec/models/moderated_grading/provisional_grade_spec.rb @@ -318,14 +318,14 @@ describe ModeratedGrading::ProvisionalGrade do it 'updates the graded_at timestamp when changing grade' do Timecop.freeze(@now) do - provisional_grade.update_attributes(grade: 'B') + provisional_grade.update(grade: 'B') expect(provisional_grade.graded_at).to eql @now end end it 'updates the graded_at timestamp when changing score' do Timecop.freeze(@now) do - provisional_grade.update_attributes(score: 80) + provisional_grade.update(score: 80) expect(provisional_grade.graded_at).to eql @now end end diff --git a/spec/models/originality_report_spec.rb b/spec/models/originality_report_spec.rb index 49c47bab5fe..c0910e9adc6 100644 --- a/spec/models/originality_report_spec.rb +++ b/spec/models/originality_report_spec.rb @@ -55,7 +55,7 @@ describe OriginalityReport do end it 'allows the "pending" workflow state' do - subject.update_attributes(originality_score: nil) + subject.update(originality_score: nil) expect(subject.workflow_state).to eq 'pending' end @@ -139,7 +139,7 @@ describe OriginalityReport do workflow_state: 'pending', lti_link_attributes: lti_link_attributes ) - report.update_attributes(lti_link_attributes: { id: report.lti_link.id, resource_url: 'http://example.com' }) + report.update(lti_link_attributes: { id: report.lti_link.id, resource_url: 'http://example.com' }) expect(report.lti_link.resource_url).to eq 'http://example.com' end @@ -152,7 +152,7 @@ describe OriginalityReport do lti_link_attributes: lti_link_attributes ) link_id = report.lti_link.id - report.update_attributes!(lti_link_attributes: { id: link_id, _destroy: true }) + report.update!(lti_link_attributes: { id: link_id, _destroy: true }) expect(Lti::Link.find_by(id: link_id)).to be_nil end end @@ -162,7 +162,7 @@ describe OriginalityReport do let(:report_with_score){ OriginalityReport.new(attachment: attachment, submission: submission, originality_score: 23.2) } it "updates state to 'scored' if originality_score is set on existing record" do - report_no_score.update_attributes(originality_score: 23.0) + report_no_score.update(originality_score: 23.0) expect(report_no_score.workflow_state).to eq 'scored' end @@ -173,7 +173,7 @@ describe OriginalityReport do it "updates state to 'pending' if originality_score is set to nil on existing record" do report_with_score.save - report_with_score.update_attributes(originality_score: nil) + report_with_score.update(originality_score: nil) expect(report_with_score.workflow_state).to eq 'pending' end @@ -184,14 +184,14 @@ describe OriginalityReport do it "does not change workflow_state if it is set to 'error'" do report_with_score.save - report_with_score.update_attributes(workflow_state: 'error') - report_with_score.update_attributes(originality_score: 23.2) + report_with_score.update(workflow_state: 'error') + report_with_score.update(originality_score: 23.2) expect(report_with_score.workflow_state).to eq 'error' end it "updates state to 'error' if an error message is present" do report_with_score.save - report_with_score.update_attributes(error_message: 'An error occured.') + report_with_score.update(error_message: 'An error occured.') expect(report_with_score.workflow_state).to eq 'error' end end @@ -244,7 +244,7 @@ describe OriginalityReport do let(:report) { subject } it 'creates an LTI launch URL if a lti_link is present' do - report.update_attributes(lti_link: lti_link) + report.update(lti_link: lti_link) expected_url = "/courses/"\ "#{submission.assignment.course.id}/assignments/"\ "#{submission.assignment.id}/lti/resource/#{lti_link.resource_link_id}?display=borderless" @@ -253,7 +253,7 @@ describe OriginalityReport do it 'uses the originality_report_url when the link id is present' do non_lti_url = 'http://www.test.com/report' - report.update_attributes(originality_report_url: non_lti_url) + report.update(originality_report_url: non_lti_url) expect(report.report_launch_path).to eq non_lti_url end end @@ -266,7 +266,7 @@ describe OriginalityReport do end it "returns the state from similarity score if workflow state is 'scored'" do - report.update_attributes(originality_score: '25') + report.update(originality_score: '25') expect(report.state).to eq 'warning' end end diff --git a/spec/models/quizzes/quiz_spec.rb b/spec/models/quizzes/quiz_spec.rb index b7a691b3430..91d0e387c50 100644 --- a/spec/models/quizzes/quiz_spec.rb +++ b/spec/models/quizzes/quiz_spec.rb @@ -1786,7 +1786,7 @@ describe Quizzes::Quiz do expect(quiz.show_correct_answers_at).to be_nil expect(quiz.hide_correct_answers_at).to be_nil - quiz.update_attributes({ + quiz.update({ show_correct_answers: true, show_correct_answers_at: 2.days.from_now, hide_correct_answers_at: 5.days.from_now @@ -1795,7 +1795,7 @@ describe Quizzes::Quiz do expect(quiz.show_correct_answers_at).not_to be_nil expect(quiz.hide_correct_answers_at).not_to be_nil - quiz.update_attributes({ + quiz.update({ show_correct_answers: false }) @@ -1817,7 +1817,7 @@ describe Quizzes::Quiz do expect(quiz.show_correct_answers?(@user, submission)).to be_falsey - quiz.update_attributes({ one_time_results: true }) + quiz.update({ one_time_results: true }) expect(quiz.show_correct_answers?(@user, submission)).to be_truthy end @@ -1938,7 +1938,7 @@ describe Quizzes::Quiz do context "when the quiz is due in a closed grading period" do before(:once) do - @quiz.update_attributes(due_at: 4.weeks.ago) + @quiz.update(due_at: 4.weeks.ago) end it "is true for admins" do @@ -1952,7 +1952,7 @@ describe Quizzes::Quiz do context "when the quiz is due in an open grading period" do before(:once) do - @quiz.update_attributes(due_at: 2.weeks.ago) + @quiz.update(due_at: 2.weeks.ago) end it "is true for admins" do @@ -1966,7 +1966,7 @@ describe Quizzes::Quiz do context "when the quiz is due after all grading periods" do before(:once) do - @quiz.update_attributes(due_at: 1.day.from_now) + @quiz.update(due_at: 1.day.from_now) end it "is true for admins" do @@ -1980,7 +1980,7 @@ describe Quizzes::Quiz do context "when the quiz is due before all grading periods" do before(:once) do - @quiz.update_attributes(due_at: 6.weeks.ago) + @quiz.update(due_at: 6.weeks.ago) end it "is true for admins" do @@ -1994,7 +1994,7 @@ describe Quizzes::Quiz do context "when the quiz has no due date" do before(:once) do - @quiz.update_attributes(due_at: nil) + @quiz.update(due_at: nil) end it "is true for admins" do @@ -2008,7 +2008,7 @@ describe Quizzes::Quiz do context "when the quiz is due in a closed grading period for a student" do before(:once) do - @quiz.update_attributes(due_at: 2.days.from_now) + @quiz.update(due_at: 2.days.from_now) override = @quiz.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -2026,7 +2026,7 @@ describe Quizzes::Quiz do context "when the quiz is overridden with no due date for a student" do before(:once) do - @quiz.update_attributes(due_at: nil) + @quiz.update(due_at: nil) override = @quiz.assignment_overrides.build override.set = @course.default_section override.save! @@ -2043,7 +2043,7 @@ describe Quizzes::Quiz do context "when the quiz has a deleted override in a closed grading period for a student" do before(:once) do - @quiz.update_attributes(due_at: 2.days.from_now) + @quiz.update(due_at: 2.days.from_now) override = @quiz.assignment_overrides.build override.set = @course.default_section override.override_due_at(4.weeks.ago) @@ -2062,7 +2062,7 @@ describe Quizzes::Quiz do context "when the quiz is overridden with no due date and is only visible to overrides" do before(:once) do - @quiz.update_attributes(due_at: 4.weeks.ago, only_visible_to_overrides: true) + @quiz.update(due_at: 4.weeks.ago, only_visible_to_overrides: true) override = @quiz.assignment_overrides.build override.set = @course.default_section override.save! diff --git a/spec/models/quizzes/quiz_statistics/student_analysis_spec.rb b/spec/models/quizzes/quiz_statistics/student_analysis_spec.rb index 247fca5e22c..4b3967c7b4e 100644 --- a/spec/models/quizzes/quiz_statistics/student_analysis_spec.rb +++ b/spec/models/quizzes/quiz_statistics/student_analysis_spec.rb @@ -132,7 +132,7 @@ describe Quizzes::QuizStatistics::StudentAnalysis do @user1 = User.create! :name => "some_user 1" student_in_course :course => @course, :user => @user1 quiz = @course.quizzes.create! - quiz.update_attributes(:published_at => Time.zone.now, :quiz_type => 'survey', :anonymous_submissions => true) + quiz.update(:published_at => Time.zone.now, :quiz_type => 'survey', :anonymous_submissions => true) quiz.quiz_questions.create!(question_data: essay_question_data) quiz.generate_quiz_data quiz.save @@ -509,7 +509,7 @@ describe Quizzes::QuizStatistics::StudentAnalysis do it 'should not show student names for anonymous submissions' do student_in_course(:active_all => true) q = @course.quizzes.create! - q.update_attributes(:published_at => Time.zone.now, :quiz_type => 'survey', :anonymous_submissions => true) + q.update(:published_at => Time.zone.now, :quiz_type => 'survey', :anonymous_submissions => true) q.quiz_questions.create!(:question_data => {:name => 'q1', :points_possible => 1, 'question_type' => 'multiple_choice_question', 'answers' => [{'answer_text' => '', 'answer_html' => 'zero', 'answer_weight' => '100'}, {'answer_text' => "", 'answer_html' => "

one

", '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