DEV: Upgrade Discourse to Rails 6 (#8083)

* Adjustments to pass specs on Rails 6.0.0
* Use classic autoloader instead of Zeitwerk
* Update Rails 6.0.0 deprecated methods
* Rails 6.0.0 not allowing column with integer name
* Drop freedom_patches/rails6.rb
* Default value for trigger_transactional_callbacks? is true
* Bump rspec-rails version to 4.0.0.beta2
This commit is contained in:
Krzysztof Kotlarek
2019-09-12 10:41:50 +10:00
committed by Sam
parent eeb84806bc
commit 32b8a2ccff
17 changed files with 80 additions and 185 deletions

View File

@@ -39,7 +39,7 @@ describe BadgesController do
it 'renders rss feed of a badge' do
get "/badges/#{badge.id}.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
end
end

View File

@@ -426,7 +426,7 @@ describe GroupsController do
get "/groups/#{group.name}/posts.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
end
@@ -435,7 +435,7 @@ describe GroupsController do
get "/groups/#{group.name}/mentions.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
it 'fails when disabled' do

View File

@@ -320,7 +320,7 @@ RSpec.describe ListController do
it 'renders latest RSS' do
get "/latest.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
it 'renders links correctly with subfolder' do
@@ -337,14 +337,14 @@ RSpec.describe ListController do
it 'renders top RSS' do
get "/top.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
TopTopic.periods.each do |period|
it "renders #{period} top RSS" do
get "/top/#{period}.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
end
end
@@ -433,7 +433,7 @@ RSpec.describe ListController do
it 'renders RSS' do
get "/c/#{category.slug}.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
it "renders RSS in subfolder correctly" do

View File

@@ -20,7 +20,7 @@ RSpec.describe MetadataController do
get "/manifest.webmanifest"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/manifest+json')
expect(response.media_type).to eq('application/manifest+json')
manifest = JSON.parse(response.body)
expect(manifest["name"]).to eq(title)
@@ -98,7 +98,7 @@ RSpec.describe MetadataController do
expect(response.body).to include("/search?q={searchTerms}")
expect(response.body).to include('image/png')
expect(response.body).to include(UrlHelper.absolute(upload.url))
expect(response.content_type).to eq('application/xml')
expect(response.media_type).to eq('application/xml')
end
end
@@ -121,7 +121,7 @@ RSpec.describe MetadataController do
expect(response.status).to eq(200)
expect(response.body).to include("hash_of_app_certificate")
expect(response.body).to include("com.example.app")
expect(response.content_type).to eq('application/json')
expect(response.media_type).to eq('application/json')
end
end
@@ -143,7 +143,7 @@ RSpec.describe MetadataController do
expect(response.status).to eq(200)
expect(response.body).to include("applinks")
expect(response.content_type).to eq('application/json')
expect(response.media_type).to eq('application/json')
get "/apple-app-site-association.json"
expect(response.status).to eq(404)

View File

@@ -26,7 +26,7 @@ describe StaticController do
get '/favicon/proxied'
expect(response.status).to eq(200)
expect(response.content_type).to eq('image/png')
expect(response.media_type).to eq('image/png')
expect(response.body.bytesize).to eq(SiteIconManager.favicon.filesize)
end
@@ -36,7 +36,7 @@ describe StaticController do
get '/favicon/proxied'
expect(response.status).to eq(200)
expect(response.content_type).to eq('image/png')
expect(response.media_type).to eq('image/png')
expect(response.body.bytesize).to eq(upload.filesize)
end
end
@@ -66,7 +66,7 @@ describe StaticController do
get '/favicon/proxied'
expect(response.status).to eq(200)
expect(response.content_type).to eq('image/png')
expect(response.media_type).to eq('image/png')
expect(response.body.bytesize).to eq(upload.filesize)
end
end

View File

@@ -1998,7 +1998,7 @@ RSpec.describe TopicsController do
it 'renders rss of the topic' do
get "/t/foo/#{topic.id}.rss"
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
expect(response.media_type).to eq('application/rss+xml')
end
it 'renders rss of the topic correctly with subfolder' do