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")
|
||||
end
|
||||
|
||||
context "when running on a multisite connection" do
|
||||
before do
|
||||
Rails.configuration.multisite = true
|
||||
end
|
||||
context "when running on a multisite connection", type: :multisite do
|
||||
it "redirects to the signed_url_for_path with the multisite DB name in the url" do
|
||||
freeze_time
|
||||
get upload.short_path
|
||||
|
|
|
@ -691,30 +691,24 @@ RSpec.describe InlineUploads do
|
|||
MD
|
||||
end
|
||||
|
||||
it "should correct image URLs in multisite" do
|
||||
begin
|
||||
Rails.configuration.multisite = true
|
||||
it "should correct image URLs in multisite", type: :multisite do
|
||||
md = <<~MD
|
||||
https:#{upload2.url} https:#{upload2.url}
|
||||
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}
|
||||
|
||||
md = <<~MD
|
||||
https:#{upload2.url} https:#{upload2.url}
|
||||
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}
|
||||
<img src="#{upload.url}" alt="some image">
|
||||
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}" alt="some image">
|
||||
<img src="#{upload3.url}">
|
||||
MD
|
||||
|
||||
<img src="#{upload.url}" alt="some image">
|
||||
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}" alt="some image">
|
||||
<img src="#{upload3.url}">
|
||||
MD
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
#{Discourse.base_url}#{upload2.short_path} #{Discourse.base_url}#{upload2.short_path}
|
||||
#{Discourse.base_url}#{upload2.short_path}
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
#{Discourse.base_url}#{upload2.short_path} #{Discourse.base_url}#{upload2.short_path}
|
||||
#{Discourse.base_url}#{upload2.short_path}
|
||||
|
||||
![some image](#{upload.short_url})
|
||||
![some image](#{upload2.short_url})
|
||||
![](#{upload3.short_url})
|
||||
MD
|
||||
ensure
|
||||
Rails.configuration.multisite = false
|
||||
end
|
||||
![some image](#{upload.short_url})
|
||||
![some image](#{upload2.short_url})
|
||||
![](#{upload3.short_url})
|
||||
MD
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Redis rake tasks" do
|
||||
RSpec.describe "Redis rake tasks", type: :multisite do
|
||||
let(:redis) { Discourse.redis.without_namespace }
|
||||
|
||||
before do
|
||||
@multisite = Rails.configuration.multisite
|
||||
Rails.configuration.multisite = true
|
||||
Discourse::Application.load_tasks
|
||||
end
|
||||
|
||||
after do
|
||||
Rails.configuration.multisite = @multisite
|
||||
end
|
||||
|
||||
describe 'clean up' do
|
||||
it 'should clean up orphan Redis keys' do
|
||||
active_keys = [
|
||||
|
|
|
@ -43,7 +43,7 @@ RSpec.describe "tasks/uploads" do
|
|||
context "when the store is internal" do
|
||||
it "does nothing; this is for external store only" do
|
||||
Upload.expects(:transaction).never
|
||||
invoke_task
|
||||
expect { invoke_task }.to raise_error(SystemExit)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue