From 247189ecdaa314ae8652f0b2e1bd44c80cec3381 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Tue, 20 Oct 2020 12:15:11 -0600 Subject: [PATCH] rails 6: fixes for integration specs Change-Id: Idfff9d798ce3f3f65c7a3ed97bfd1669ba20e240 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250574 Tested-by: Service Cloud Jenkins Reviewed-by: Simon Williams QA-Review: Simon Williams Product-Review: Simon Williams --- app/presenters/to_do_list_presenter.rb | 2 +- .../external_tools_controller_spec.rb | 2 +- spec/integration/files_spec.rb | 20 +++++++++---------- spec/integration/security_spec.rb | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/presenters/to_do_list_presenter.rb b/app/presenters/to_do_list_presenter.rb index e7b884930d7..d9f32df0b39 100644 --- a/app/presenters/to_do_list_presenter.rb +++ b/app/presenters/to_do_list_presenter.rb @@ -59,7 +59,7 @@ class ToDoListPresenter def assignments_needing(type, opts = {}) if @user - @user.send("assignments_needing_#{type}", {contexts: @contexts, limit: ASSIGNMENT_LIMIT}.merge(opts)).map do |assignment| + @user.send("assignments_needing_#{type}", **{contexts: @contexts, limit: ASSIGNMENT_LIMIT}.merge(opts)).map do |assignment| AssignmentPresenter.new(@view, assignment, @user, type) end else diff --git a/spec/integration/external_tools_controller_spec.rb b/spec/integration/external_tools_controller_spec.rb index 99c65422919..fd6ec7d68e0 100644 --- a/spec/integration/external_tools_controller_spec.rb +++ b/spec/integration/external_tools_controller_spec.rb @@ -206,7 +206,7 @@ describe ExternalToolsController do headers: {'CONTENT_TYPE' => 'application/json'} ) - expect(response).not_to be_success + expect(response).not_to be_successful end it 'ignores non-required params' do diff --git a/spec/integration/files_spec.rb b/spec/integration/files_spec.rb index eb28bc07961..4ae1384f6eb 100644 --- a/spec/integration/files_spec.rb +++ b/spec/integration/files_spec.rb @@ -90,7 +90,7 @@ describe FilesController do get location expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' # ensure that the user wasn't logged in by the normal means expect(controller.instance_variable_get(:@current_user)).to be_nil end @@ -99,7 +99,7 @@ describe FilesController do allow(HostUrl).to receive(:file_host).and_return('test.host') get "http://test.host/users/#{@me.id}/files/#{@att.id}/download" expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' expect(response['Pragma']).to be_nil expect(response['Cache-Control']).not_to match(/no-cache/) end @@ -139,7 +139,7 @@ describe FilesController do get return_location # the response will be on the main domain, with an iframe pointing to the files domain and the actual uploaded html file expect(response).to be_successful - expect(response.content_type).to eq 'text/html' + expect(response.media_type).to eq 'text/html' doc = Nokogiri::HTML::DocumentFragment.parse(response.body) expect(doc.at_css('iframe#file_content')['src']).to match %r{^http://files-test.host/users/#{@me.id}/files/#{@att.id}/my%20files/unfiled/ohai.html} end @@ -151,7 +151,7 @@ describe FilesController do location = response['Location'] expect(URI.parse(location).path).to eq "/users/#{@me.id}/files/#{@att.id}" get location - expect(response.content_type).to eq 'text/html' + expect(response.media_type).to eq 'text/html' doc = Nokogiri::HTML::DocumentFragment.parse(response.body) expect(doc.at_css('iframe#file_content')['src']).to match %r{^http://test.host/users/#{@me.id}/files/#{@att.id}/my%20files/unfiled/ohai.html} end @@ -253,7 +253,7 @@ describe FilesController do get location expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' # ensure that the user wasn't logged in by the normal means expect(controller.instance_variable_get(:@current_user)).to be_nil end @@ -275,7 +275,7 @@ describe FilesController do get location expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' # ensure that the user wasn't logged in by the normal means expect(controller.instance_variable_get(:@current_user)).to be_nil end @@ -297,7 +297,7 @@ describe FilesController do # the response will be on the main domain, with an iframe pointing to the files domain and the actual uploaded html file get "http://test.host/courses/#{@course.id}/files/#{@att.id}?fd_cookie_set=1" # just send in the param since other specs test the cookie redirect expect(response).to be_successful - expect(response.content_type).to eq 'text/html' + expect(response.media_type).to eq 'text/html' doc = Nokogiri::HTML::DocumentFragment.parse(response.body) location = doc.at_css('iframe#file_content')['src'] @@ -335,7 +335,7 @@ describe FilesController do get location expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' # ensure that the user wasn't logged in by the normal means expect(controller.instance_variable_get(:@current_user)).to be_nil end @@ -354,7 +354,7 @@ describe FilesController do allow(HostUrl).to receive(:file_host).and_return('test.host') get url expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' expect(response['Pragma']).to be_nil expect(response['Cache-Control']).not_to match(/no-cache/) end @@ -388,7 +388,7 @@ describe FilesController do get location expect(response).to be_successful - expect(response.content_type).to eq 'image/png' + expect(response.media_type).to eq 'image/png' expect(controller.instance_variable_get(:@current_user)).to be_nil expect(controller.instance_variable_get(:@context)).to be_nil end diff --git a/spec/integration/security_spec.rb b/spec/integration/security_spec.rb index 3e941b58a25..c637063dfc7 100644 --- a/spec/integration/security_spec.rb +++ b/spec/integration/security_spec.rb @@ -406,7 +406,7 @@ describe "security" do user_session(@student) post "/courses/#{@course.id}/user_lists.json", params: {:user_list => "A1234567, A345678"} - expect(response).not_to be_success + expect(response).not_to be_successful user_session(@teacher) post "/courses/#{@course.id}/user_lists.json", params: {:user_list => "A1234567, A345678"}