Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-24 10:20:28 +01:00
31 Zeilen
940 B
Ruby
31 Zeilen
940 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe Jobs::SetAfterTimeWizard do
|
|
fab!(:user1) { Fabricate(:user) }
|
|
fab!(:user2) { Fabricate(:user) }
|
|
fab!(:user3) { Fabricate(:user) }
|
|
|
|
let(:template) { get_wizard_fixture("wizard") }
|
|
|
|
it "sets wizard redirect for all users " do
|
|
after_time_template = template.dup
|
|
after_time_template["after_time"] = true
|
|
after_time_template["after_time_scheduled"] = (Time.now + 3.hours).iso8601
|
|
|
|
CustomWizard::Template.save(after_time_template)
|
|
|
|
messages = MessageBus.track_publish("/redirect_to_wizard") do
|
|
described_class.new.execute(wizard_id: 'super_mega_fun_wizard')
|
|
end
|
|
|
|
expect(
|
|
UserCustomField.where(
|
|
name: 'redirect_to_wizard',
|
|
value: 'super_mega_fun_wizard'
|
|
).length
|
|
).to eq(3)
|
|
|
|
expect(messages.first.data).to eq("super_mega_fun_wizard")
|
|
expect(messages.first.user_ids).to match_array([user1.id, user2.id, user3.id])
|
|
end
|
|
end
|