mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
give name to work package short path
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ Rails.application.routes.draw do
|
||||
get "/wp(/)" => redirect("#{rails_relative_url_root}/work_packages")
|
||||
get "/wp/*rest" => redirect { |params, _req|
|
||||
"#{rails_relative_url_root}/work_packages/#{URI::RFC2396_Parser.new.escape(params[:rest])}"
|
||||
}
|
||||
}, as: :work_package_short
|
||||
|
||||
# Add catch method for Rack OmniAuth to allow route helpers
|
||||
# Note: This renders a 404 in rails but is caught by omniauth in Rack before
|
||||
|
||||
@@ -56,5 +56,10 @@ RSpec.describe "routes for old issue uris", type: :request do
|
||||
expect(last_response).to be_redirect
|
||||
expect(last_response.location).to end_with "/work_packages/1234"
|
||||
end
|
||||
|
||||
it "has a path helper" do
|
||||
expect(work_package_short_path("123")).to eq("/wp/123")
|
||||
expect(work_package_short_path(%w[123 a_tab foo])).to eq("/wp/123/a_tab/foo")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user