Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-30 20:41:11 +01:00
Ensure route_to action works if code is blank string
Dieser Commit ist enthalten in:
Ursprung
895ee9dd96
Commit
140f11ecc6
2 geänderte Dateien mit 18 neuen und 6 gelöschten Zeilen
|
@ -425,7 +425,7 @@ class CustomWizard::Action
|
||||||
).perform
|
).perform
|
||||||
end
|
end
|
||||||
|
|
||||||
if action['code']
|
if action['code'].present?
|
||||||
@submission.fields[action['code']] = SecureRandom.hex(8)
|
@submission.fields[action['code']] = SecureRandom.hex(8)
|
||||||
url += "&#{action['code']}=#{@submission.fields[action['code']]}"
|
url += "&#{action['code']}=#{@submission.fields[action['code']]}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -212,11 +212,23 @@ describe CustomWizard::Action do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 're-routes a user' do
|
context "route to action" do
|
||||||
wizard = CustomWizard::Builder.new(@template[:id], user).build
|
it 're-routes a user' do
|
||||||
updater = wizard.create_updater(wizard.steps.last.id, {})
|
wizard = CustomWizard::Builder.new(@template[:id], user).build
|
||||||
updater.update
|
updater = wizard.create_updater(wizard.steps.last.id, {})
|
||||||
expect(updater.result[:redirect_on_next]).to eq("https://google.com")
|
updater.update
|
||||||
|
expect(updater.result[:redirect_on_next]).to eq("https://google.com")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "works if the code field has a blank string" do
|
||||||
|
wizard_template[:actions].last[:code] = " "
|
||||||
|
update_template(wizard_template)
|
||||||
|
|
||||||
|
wizard = CustomWizard::Builder.new(@template[:id], user).build
|
||||||
|
updater = wizard.create_updater(wizard.steps.last.id, {})
|
||||||
|
updater.update
|
||||||
|
expect(updater.result[:redirect_on_next]).to eq("https://google.com")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "standard subscription actions" do
|
context "standard subscription actions" do
|
||||||
|
|
Laden …
In neuem Issue referenzieren