Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

rename Routes to RouteConstraint

Ivan Kuchina867b3a4add0
diff --git a/config/routes.rb b/config/routes.rb
index 8c273c0506c..fab0201531d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -168,13 +168,13 @@ Rails.application.routes.draw do
end
# generic route for adding/removing watchers
- scope ":object_type/:object_id", constraints: OpenProject::Acts::Watchable::Routes do
+ scope ":object_type/:object_id", constraints: OpenProject::Acts::Watchable::RouteConstraint do
post "/watch" => "watchers#watch"
delete "/unwatch" => "watchers#unwatch"
end
# generic route for adding/removing favorites
- scope ":object_type/:object_id", constraints: OpenProject::Acts::Favorable::Routes do
+ scope ":object_type/:object_id", constraints: OpenProject::Acts::Favorable::RouteConstraint do
post "/favorite" => "favorites#favorite"
delete "/favorite" => "favorites#unfavorite"
end
diff --git a/lib_static/open_project/acts/favorable/routes.rb b/lib_static/open_project/acts/favorable/route_constraint.rb
similarity index 98%
rename from lib_static/open_project/acts/favorable/routes.rb
rename to lib_static/open_project/acts/favorable/route_constraint.rb
index afd526649cd..fde3ccf542f 100644
--- a/lib_static/open_project/acts/favorable/routes.rb
+++ b/lib_static/open_project/acts/favorable/route_constraint.rb
@@ -29,7 +29,7 @@
module OpenProject
module Acts
module Favorable
- module Routes
+ module RouteConstraint
def self.matches?(request)
params = request.path_parameters
diff --git a/lib_static/open_project/acts/watchable/routes.rb b/lib_static/open_project/acts/watchable/route_constraint.rb
similarity index 98%
rename from lib_static/open_project/acts/watchable/routes.rb
rename to lib_static/open_project/acts/watchable/route_constraint.rb
index e6a7327534d..a079735ee5d 100644
--- a/lib_static/open_project/acts/watchable/routes.rb
+++ b/lib_static/open_project/acts/watchable/route_constraint.rb
@@ -29,7 +29,7 @@
module OpenProject
module Acts
module Watchable
- module Routes
+ module RouteConstraint
def self.matches?(request)
params = request.path_parameters
diff --git a/spec/lib/acts_as_watchable/lib/acts_as_watchable/routes_spec.rb b/spec/lib/acts_as_watchable/lib/acts_as_watchable/route_constraint_spec.rb
similarity index 97%
rename from spec/lib/acts_as_watchable/lib/acts_as_watchable/routes_spec.rb
rename to spec/lib/acts_as_watchable/lib/acts_as_watchable/route_constraint_spec.rb
index 4a8f633e98b..8d92881a7eb 100644
--- a/spec/lib/acts_as_watchable/lib/acts_as_watchable/routes_spec.rb
+++ b/spec/lib/acts_as_watchable/lib/acts_as_watchable/route_constraint_spec.rb
@@ -28,7 +28,7 @@
require "spec_helper"
-RSpec.describe OpenProject::Acts::Watchable::Routes do
+RSpec.describe OpenProject::Acts::Watchable::RouteConstraint do
let(:request) do
Struct.new(:type, :id) do
def path_parameters
diff --git a/spec/routing/watchers_spec.rb b/spec/routing/watchers_spec.rb
index fb674bfb7e6..ee9ca61affd 100644
--- a/spec/routing/watchers_spec.rb
+++ b/spec/routing/watchers_spec.rb
@@ -31,7 +31,7 @@ require "spec_helper"
RSpec.describe WatchersController do
shared_examples_for "watched model routes" do
before do
- expect(OpenProject::Acts::Watchable::Routes).to receive(:matches?).and_return(true)
+ allow(OpenProject::Acts::Watchable::RouteConstraint).to receive(:matches?).and_return(true)
end
it "connects POST /:object_type/:object_id/watch to watchers#watch" do