Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
added more specs and fixed formatting
Dieser Commit ist enthalten in:
Ursprung
c1481e2ad4
Commit
dec5f5b5ce
2 geänderte Dateien mit 30 neuen und 3 gelöschten Zeilen
|
@ -23,7 +23,7 @@ module CustomWizardGuardian
|
|||
def creating_wizard(topic)
|
||||
wizard_id = topic.wizard_created.presence
|
||||
wizard = CustomWizard::Builder.new(wizard_id, @user).build if wizard_id
|
||||
return wizard.presence
|
||||
wizard.presence
|
||||
end
|
||||
|
||||
def wizard_can_create_topic_on_category?(wizard, topic)
|
||||
|
|
|
@ -65,4 +65,31 @@ describe ::Guardian do
|
|||
expect(user.guardian.send(:wizard_user_can_create_topic_on_category?, topic)).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
context "the wizard can't create a topic in the category" do
|
||||
it "restricts editing the topic first post" do
|
||||
wizard = CustomWizard::Builder.new(@template[:id], user).build
|
||||
wizard.create_updater(
|
||||
wizard.steps.first.id,
|
||||
step_1_field_1: "Topic Title",
|
||||
step_1_field_2: "topic body"
|
||||
).update
|
||||
wizard.create_updater(wizard.steps.second.id, {}).update
|
||||
wizard.create_updater(wizard.steps.last.id,
|
||||
step_3_field_3: category.id
|
||||
).update
|
||||
|
||||
topic = Topic.where(
|
||||
title: "Topic Title",
|
||||
category_id: category.id
|
||||
).first
|
||||
|
||||
new_category = Fabricate(:category)
|
||||
topic.category_id = new_category.id
|
||||
topic.save
|
||||
topic.reload
|
||||
|
||||
expect(user.guardian.send(:wizard_user_can_create_topic_on_category?, topic)).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren