fix remaining application_controller specs for Rails 6.1

refs FOO-2746

Change-Id: I29ee420672cc2aedac7b7e431808f9c6dfaa4508
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287131
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
Aaron Ogata 2022-03-15 09:12:56 -07:00
parent 7c58a814ed
commit af20e417dd
1 changed files with 7 additions and 6 deletions

View File

@ -28,6 +28,7 @@ RSpec.describe ApplicationController do
context "group 1" do
before do
request_double = double(
cookies_same_site_protection: proc { false },
host_with_port: "www.example.com",
host: "www.example.com",
url: "http://www.example.com",
@ -734,9 +735,6 @@ RSpec.describe ApplicationController do
end
it "logs error reports to the domain_root_accounts shard" do
report = ErrorReport.new
allow(ErrorReport).to receive(:log_exception).and_return(report)
allow(ErrorReport).to receive(:find).and_return(report)
allow(Canvas::Errors::Info).to receive(:useful_http_env_stuff_from_request).and_return({})
req = double
@ -752,9 +750,12 @@ RSpec.describe ApplicationController do
controller.instance_variable_set(:@domain_root_account, @account)
expect(@shard2).to receive(:activate)
controller.send(:rescue_action_in_public, Exception.new)
expect(ErrorReport.count).to eq 0
@shard2.activate do
expect(ErrorReport.count).to eq 1
end
end
end
end
@ -1504,7 +1505,7 @@ RSpec.describe ApplicationController do
describe "verify_authenticity_token" do
before do
# default setup is a protected non-GET non-API session-authenticated request with bogus tokens
cookies = ActionDispatch::Cookies::CookieJar.new(nil)
cookies = ActionDispatch::Cookies::CookieJar.new(controller.request)
controller.allow_forgery_protection = true
allow(controller.request).to receive(:cookie_jar).and_return(cookies)
allow(controller.request).to receive(:get?).and_return(false)