From d36d89adfc4ef4d52f260523dfed1db2f7dae512 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 30 Sep 2013 16:52:32 +0200 Subject: [PATCH] Moves routing specs --- ...controller.rb => categories_controller.rb} | 2 +- config/routes.rb | 2 +- spec/routing/categories_spec.rb | 62 +++++++++++++++++++ test/integration/routing_test.rb | 24 ------- 4 files changed, 64 insertions(+), 26 deletions(-) rename app/controllers/{issue_categories_controller.rb => categories_controller.rb} (98%) create mode 100644 spec/routing/categories_spec.rb diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/categories_controller.rb similarity index 98% rename from app/controllers/issue_categories_controller.rb rename to app/controllers/categories_controller.rb index fdf460ae3df..94ce27e7212 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -27,7 +27,7 @@ # See doc/COPYRIGHT.rdoc for more details. #++ -class IssueCategoriesController < ApplicationController +class CategoriesController < ApplicationController menu_item :settings model_object IssueCategory before_filter :find_model_object, :except => [:new, :create] diff --git a/config/routes.rb b/config/routes.rb index 2411934af4d..b7bd87d7172 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -231,7 +231,7 @@ OpenProject::Application.routes.draw do resources :boards - resources :issue_categories, :except => [:index, :show], :shallow => true + resources :categories, :except => [:index, :show], :shallow => true resources :members, :only => [:create, :update, :destroy], :shallow => true do get :autocomplete, :on => :collection diff --git a/spec/routing/categories_spec.rb b/spec/routing/categories_spec.rb new file mode 100644 index 00000000000..3ce54ab671f --- /dev/null +++ b/spec/routing/categories_spec.rb @@ -0,0 +1,62 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2013 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +require 'spec_helper' + +describe CategoriesController do + + it "should connect GET /projects/test/categories/new to categories#new" do + get("/projects/test/categories/new").should route_to( controller: 'categories', + action: 'new', + project_id: 'test' ) + end + + it "should connect POST /projects/test/categories to categories#create" do + post("/projects/test/categories").should route_to( controller: 'categories', + action: 'create', + project_id: 'test' ) + end + + it "should connect GET /categories/5/edit to categories#edit" do + get("/categories/5/edit").should route_to( controller: 'categories', + action: 'edit', + id: '5' ) + end + + it "should connect PUT /categories/5 to categories#update" do + put("/categories/5").should route_to( controller: 'categories', + action: 'update', + id: '5' ) + end + + it "should connect DELETE /categories/5 to categories#delete" do + delete("/categories/5").should route_to( controller: 'categories', + action: 'destroy', + id: '5' ) + end +end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 2f4e4c48d0f..d0855b4e062 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -221,30 +221,6 @@ class RoutingTest < ActionDispatch::IntegrationTest :field => 'description' ) end - context "issue categories" do - context "project scoped" do - should route(:get, "/projects/test/issue_categories/new").to( :controller => 'issue_categories', - :action => 'new', - :project_id => 'test' ) - - should route(:post, "/projects/test/issue_categories").to( :controller => 'issue_categories', - :action => 'create', - :project_id => 'test' ) - - should route(:get, "/issue_categories/5/edit").to( :controller => 'issue_categories', - :action => 'edit', - :id => '5' ) - - should route(:put, "/issue_categories/5").to( :controller => 'issue_categories', - :action => 'update', - :id => '5' ) - - should route(:delete, "/issue_categories/5").to( :controller => 'issue_categories', - :action => 'destroy', - :id => '5' ) - end - end - context "members" do context "project scoped" do should route(:post, "/projects/5234/members").to( :controller => 'members',