mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Use the type: :multisite
spec setting (#9245)
Fixes recent spec flakiness. Also includes: DEV: Prevent accidental exit from specs
This commit is contained in:
parent
1859e6b7ca
commit
20f3be1e9c
@ -401,10 +401,7 @@ describe UploadsController do
|
|||||||
expect(response.code).to eq("403")
|
expect(response.code).to eq("403")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when running on a multisite connection" do
|
context "when running on a multisite connection", type: :multisite do
|
||||||
before do
|
|
||||||
Rails.configuration.multisite = true
|
|
||||||
end
|
|
||||||
it "redirects to the signed_url_for_path with the multisite DB name in the url" do
|
it "redirects to the signed_url_for_path with the multisite DB name in the url" do
|
||||||
freeze_time
|
freeze_time
|
||||||
get upload.short_path
|
get upload.short_path
|
||||||
|
@ -691,10 +691,7 @@ RSpec.describe InlineUploads do
|
|||||||
MD
|
MD
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should correct image URLs in multisite" do
|
it "should correct image URLs in multisite", type: :multisite do
|
||||||
begin
|
|
||||||
Rails.configuration.multisite = true
|
|
||||||
|
|
||||||
md = <<~MD
|
md = <<~MD
|
||||||
https:#{upload2.url} https:#{upload2.url}
|
https:#{upload2.url} https:#{upload2.url}
|
||||||
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}
|
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}
|
||||||
@ -712,9 +709,6 @@ RSpec.describe InlineUploads do
|
|||||||

|

|
||||||

|

|
||||||
MD
|
MD
|
||||||
ensure
|
|
||||||
Rails.configuration.multisite = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,19 +2,13 @@
|
|||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe "Redis rake tasks" do
|
RSpec.describe "Redis rake tasks", type: :multisite do
|
||||||
let(:redis) { Discourse.redis.without_namespace }
|
let(:redis) { Discourse.redis.without_namespace }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@multisite = Rails.configuration.multisite
|
|
||||||
Rails.configuration.multisite = true
|
|
||||||
Discourse::Application.load_tasks
|
Discourse::Application.load_tasks
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
|
||||||
Rails.configuration.multisite = @multisite
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'clean up' do
|
describe 'clean up' do
|
||||||
it 'should clean up orphan Redis keys' do
|
it 'should clean up orphan Redis keys' do
|
||||||
active_keys = [
|
active_keys = [
|
||||||
|
@ -43,7 +43,7 @@ RSpec.describe "tasks/uploads" do
|
|||||||
context "when the store is internal" do
|
context "when the store is internal" do
|
||||||
it "does nothing; this is for external store only" do
|
it "does nothing; this is for external store only" do
|
||||||
Upload.expects(:transaction).never
|
Upload.expects(:transaction).never
|
||||||
invoke_task
|
expect { invoke_task }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user