Merge pull request #113 from paviliondev/fix-locales
FIX: changed wizard id resolution logic
Dieser Commit ist enthalten in:
Commit
31a27cbb00
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen
|
@ -4,7 +4,8 @@ module ExtraLocalesControllerCustomWizard
|
|||
super || begin
|
||||
return false unless bundle =~ /wizard/ && request.referer =~ /\/w\//
|
||||
path = URI(request.referer).path
|
||||
wizard_id = path.split('/w/').last
|
||||
wizard_path = path.split('/w/').last
|
||||
wizard_id = wizard_path.split('/').first
|
||||
CustomWizard::Template.exists?(wizard_id.underscore)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,6 +37,13 @@ describe ExtraLocalesControllerCustomWizard, type: :request do
|
|||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "returns wizard locales when requested by user in a wizard step" do
|
||||
sign_in(new_user)
|
||||
|
||||
get @locale_url, headers: { 'REFERER' => "/w/super-mega-fun-wizard/steps/step_1" }
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "return wizard locales if user cant access wizard" do
|
||||
template[:permitted] = permitted["permitted"]
|
||||
CustomWizard::Template.save(template.as_json)
|
||||
|
|
Laden …
In neuem Issue referenzieren