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:
parent
7c58a814ed
commit
af20e417dd
|
@ -28,6 +28,7 @@ RSpec.describe ApplicationController do
|
||||||
context "group 1" do
|
context "group 1" do
|
||||||
before do
|
before do
|
||||||
request_double = double(
|
request_double = double(
|
||||||
|
cookies_same_site_protection: proc { false },
|
||||||
host_with_port: "www.example.com",
|
host_with_port: "www.example.com",
|
||||||
host: "www.example.com",
|
host: "www.example.com",
|
||||||
url: "http://www.example.com",
|
url: "http://www.example.com",
|
||||||
|
@ -734,9 +735,6 @@ RSpec.describe ApplicationController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "logs error reports to the domain_root_accounts shard" do
|
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({})
|
allow(Canvas::Errors::Info).to receive(:useful_http_env_stuff_from_request).and_return({})
|
||||||
|
|
||||||
req = double
|
req = double
|
||||||
|
@ -752,9 +750,12 @@ RSpec.describe ApplicationController do
|
||||||
|
|
||||||
controller.instance_variable_set(:@domain_root_account, @account)
|
controller.instance_variable_set(:@domain_root_account, @account)
|
||||||
|
|
||||||
expect(@shard2).to receive(:activate)
|
|
||||||
|
|
||||||
controller.send(:rescue_action_in_public, Exception.new)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -1504,7 +1505,7 @@ RSpec.describe ApplicationController do
|
||||||
describe "verify_authenticity_token" do
|
describe "verify_authenticity_token" do
|
||||||
before do
|
before do
|
||||||
# default setup is a protected non-GET non-API session-authenticated request with bogus tokens
|
# 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
|
controller.allow_forgery_protection = true
|
||||||
allow(controller.request).to receive(:cookie_jar).and_return(cookies)
|
allow(controller.request).to receive(:cookie_jar).and_return(cookies)
|
||||||
allow(controller.request).to receive(:get?).and_return(false)
|
allow(controller.request).to receive(:get?).and_return(false)
|
||||||
|
|
Loading…
Reference in New Issue