2020-11-03 01:24:20 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-11-30 22:20:10 +01:00
|
|
|
require_relative '../../plugin_helper'
|
2020-11-03 01:24:20 +01:00
|
|
|
|
|
|
|
describe CustomWizard::BasicWizardSerializer do
|
|
|
|
fab!(:user) { Fabricate(:user) }
|
2021-03-11 07:30:15 +01:00
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
it 'should return basic wizard attributes' do
|
|
|
|
CustomWizard::Template.save(
|
|
|
|
JSON.parse(File.open(
|
|
|
|
"#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/wizard.json"
|
|
|
|
).read),
|
|
|
|
skip_jobs: true)
|
|
|
|
json = CustomWizard::BasicWizardSerializer.new(
|
|
|
|
CustomWizard::Builder.new("super_mega_fun_wizard", user).build,
|
|
|
|
scope: Guardian.new(user)
|
|
|
|
).as_json
|
|
|
|
expect(json[:basic_wizard][:id]).to eq("super_mega_fun_wizard")
|
|
|
|
expect(json[:basic_wizard][:name]).to eq("Super Mega Fun Wizard")
|
|
|
|
end
|
2021-03-11 07:30:15 +01:00
|
|
|
end
|