Skip to content
Browse files

Added routing for users

  • Loading branch information...
1 parent 0674008 commit be3075287455b17e8378b54d7e4b735bfd385ce4 Claudio Ortolina committed Feb 6, 2012
View
2 app/controllers/users_controller.rb
@@ -0,0 +1,2 @@
+class UsersController < ApplicationController
+end
View
3 config/routes.rb
@@ -1,4 +1,7 @@
DragonflyTutorial::Application.routes.draw do
+
+ resources :users, :only => [:show, :edit, :update]
+
# The priority is based upon order of creation:
# first created -> highest priority.
View
5 spec/controllers/users_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe UsersController do
+
+end
View
29 spec/routing/user_routing_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe 'User routing' do
+
+ it "should route to user show" do
+ { :get => "/users/1" }.should route_to(
+ :controller => "users",
+ :action => "show",
+ :id => "1"
+ )
+ end
+
+ it "should route to user edit" do
+ { :get => '/users/1/edit' }.should route_to(
+ :controller => "users",
+ :action => "edit",
+ :id => "1"
+ )
+ end
+
+ it "should route to user update" do
+ { :put => '/users/1' }.should route_to(
+ :controller => "users",
+ :action => "update",
+ :id => "1"
+ )
+ end
+
+end

0 comments on commit be30752

Please sign in to comment.
Something went wrong with that request. Please try again.