Commit 841edc19c6497dfcc1d03d33ff8b48a5737669eb
1 parent
6dca9da8
Exists in
colab
and in
4 other branches
UserController created to list user's projects
Showing
6 changed files
with
34 additions
and
4 deletions
Show diff stats
config/routes.rb
| 1 | 1 | Mezuro::Application.routes.draw do |
| 2 | 2 | #resources :repositories |
| 3 | 3 | |
| 4 | - devise_for :users | |
| 5 | - | |
| 6 | - root "home#index" | |
| 7 | - #resources :projects | |
| 4 | + devise_for :users | |
| 5 | + get 'users/:user_id/projects' => 'users#projects', as: :user_projects | |
| 8 | 6 | |
| 9 | 7 | resources :projects do |
| 10 | 8 | resources :repositories, except: [:update, :index] |
| 11 | 9 | get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module |
| 12 | 10 | put '/repositories/:id' => 'repositories#update', as: :repository_update |
| 13 | 11 | end |
| 12 | + | |
| 13 | + root "home#index" | |
| 14 | 14 | # The priority is based upon order of creation: first created -> highest priority. |
| 15 | 15 | # See how all your routes lay out with "rake routes". |
| 16 | 16 | ... | ... |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe UsersController do | |
| 4 | + describe 'projects' do | |
| 5 | + let(:user) { FactoryGirl.build(:user) } | |
| 6 | + | |
| 7 | + before :each do | |
| 8 | + User.expects(:find).with(user.id).returns(user) | |
| 9 | + | |
| 10 | + get :projects, user_id: user.id | |
| 11 | + end | |
| 12 | + | |
| 13 | + it { should render_template(:projects) } | |
| 14 | + end | |
| 15 | +end | ... | ... |
spec/factories/users.rb