mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:27:52 +08:00
Add tests for Site Settings import/export
- extracted out site settings rake task to a class - added tests for import and export of site settings
This commit is contained in:
25
spec/services/site_settings_spec.rb
Normal file
25
spec/services/site_settings_spec.rb
Normal file
@ -0,0 +1,25 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe SiteSettingsTask do
|
||||
|
||||
before do
|
||||
Discourse::Application.load_tasks
|
||||
end
|
||||
|
||||
describe 'export' do
|
||||
it 'creates a hash of all site settings' do
|
||||
h = SiteSettingsTask.export_to_hash
|
||||
expect(h.count).to be > 0
|
||||
end
|
||||
end
|
||||
|
||||
describe 'import' do
|
||||
it 'updates site settings' do
|
||||
yml = "title: Test"
|
||||
log, counts = SiteSettingsTask.import(yml)
|
||||
expect(log[0]).to eq "Changed title FROM: Discourse TO: Test"
|
||||
expect(counts[:updated]).to eq 1
|
||||
expect(SiteSetting.title).to eq "Test"
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user