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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
renamed ical action and cleaned up routes as proposed by @ulferts
Jonas Jabariffdff49ebb37
diff --git a/modules/calendar/app/controllers/calendar/ical_controller.rb b/modules/calendar/app/controllers/calendar/ical_controller.rbindex c3357458d6b..de8eea05995 100644--- a/modules/calendar/app/controllers/calendar/ical_controller.rb+++ b/modules/calendar/app/controllers/calendar/ical_controller.rb@@ -28,7 +28,7 @@module ::Calendarclass IcalController < ApplicationController- def ical+ def showbegincall = ::Calendar::IcalResponseService.new.call(ical_token: params[:ical_token],diff --git a/modules/calendar/config/routes.rb b/modules/calendar/config/routes.rbindex df7feeff726..17c34c53172 100644--- a/modules/calendar/config/routes.rb+++ b/modules/calendar/config/routes.rb@@ -6,8 +6,7 @@ OpenProject::Application.routes.draw doas: :calendars doget '/new' => 'calendar/calendars#show', on: :collection, as: 'new'# TODO: discuss if other controller should be used- get '/ical' => 'calendar/ical#ical', on: :member, as: 'ical'- match '/ical' => 'calendar/ical#ical', :via => :propfind+ get '/ical' => 'calendar/ical#show', on: :member, as: 'ical'get '(/*state)' => 'calendar/calendars#show', on: :member, as: ''endenddiff --git a/modules/calendar/spec/controllers/ical_controller_spec.rb b/modules/calendar/spec/controllers/ical_controller_spec.rbindex fc76fda8d93..cf949facad7 100644--- a/modules/calendar/spec/controllers/ical_controller_spec.rb+++ b/modules/calendar/spec/controllers/ical_controller_spec.rb@@ -47,8 +47,8 @@ describe Calendar::IcalController do# the ical urls are intended to be used without a logged in user from a calendar client app# before { login_as(user) }- describe '#ical' do- shared_examples_for 'ical#ical' do |expected|+ describe '#show' do+ shared_examples_for 'ical#show' do |expected|subject { response }if expected == :success@@ -61,43 +61,43 @@ describe Calendar::IcalController docontext 'with valid params' dobefore do- get :ical, params: {+ get :show, params: {project_id: project.id,id: query.id,ical_token: valid_ical_token_value}end- it_behaves_like 'ical#ical', :success+ it_behaves_like 'ical#show', :successendcontext 'with invalid token' dobefore do- get :ical, params: {+ get :show, params: {project_id: project.id,id: query.id,ical_token: SecureRandom.hex}end- it_behaves_like 'ical#ical', :failure+ it_behaves_like 'ical#show', :failureendcontext 'with invalid query' dobefore do- get :ical, params: {+ get :show, params: {project_id: project.id,id: SecureRandom.hex,ical_token: valid_ical_token_value}end- it_behaves_like 'ical#ical', :failure+ it_behaves_like 'ical#show', :failureendcontext 'with invalid project' dobefore do- get :ical, params: {+ get :show, params: {project_id: SecureRandom.hex,id: query.id,ical_token: valid_ical_token_value@@ -106,7 +106,7 @@ describe Calendar::IcalController do# TODO: the project id is actually irrelevant - the query id is enough# should the project id still be used in the ical url anyways?- it_behaves_like 'ical#ical', :success+ it_behaves_like 'ical#show', :successendendenddiff --git a/modules/calendar/spec/routing/ical_routing_spec.rb b/modules/calendar/spec/routing/ical_routing_spec.rbindex 0e889759367..6d3bbcd2514 100644--- a/modules/calendar/spec/routing/ical_routing_spec.rb+++ b/modules/calendar/spec/routing/ical_routing_spec.rb@@ -31,7 +31,7 @@ require 'spec_helper'describe Calendar::IcalController doit doexpect(get('/projects/1/calendars/2/ical')).to route_to(controller: 'calendar/ical',- action: 'ical',+ action: 'show',id: '2',project_id: '1')end