@@ -87,7 +87,7 class ProjectsController < ApplicationController | |||
|
87 | 87 | def show |
|
88 | 88 | @custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position") |
|
89 | 89 | @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} |
|
90 | @subprojects = @project.active_children | |
|
90 | @subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current)) | |
|
91 | 91 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
92 | 92 | @trackers = @project.rolled_up_trackers |
|
93 | 93 |
@@ -24,4 +24,10 members_004: | |||
|
24 | 24 | role_id: 2 |
|
25 | 25 | # Locked user |
|
26 | 26 | user_id: 5 |
|
27 | members_005: | |
|
28 | id: 5 | |
|
29 | created_on: 2006-07-19 19:35:33 +02:00 | |
|
30 | project_id: 5 | |
|
31 | role_id: 1 | |
|
32 | user_id: 2 | |
|
27 | 33 | No newline at end of file |
@@ -3,7 +3,7 projects_001: | |||
|
3 | 3 | created_on: 2006-07-19 19:13:59 +02:00 |
|
4 | 4 | name: eCookbook |
|
5 | 5 | updated_on: 2006-07-19 22:53:01 +02:00 |
|
6 |
projects_count: |
|
|
6 | projects_count: 3 | |
|
7 | 7 | id: 1 |
|
8 | 8 | description: Recipes management application |
|
9 | 9 | homepage: http://ecookbook.somenet.foo/ |
@@ -43,3 +43,15 projects_004: | |||
|
43 | 43 | is_public: true |
|
44 | 44 | identifier: subproject2 |
|
45 | 45 | parent_id: 1 |
|
46 | projects_005: | |
|
47 | created_on: 2006-07-19 19:15:51 +02:00 | |
|
48 | name: Private child of eCookbook | |
|
49 | updated_on: 2006-07-19 19:17:07 +02:00 | |
|
50 | projects_count: 0 | |
|
51 | id: 5 | |
|
52 | description: This is a private subproject of a public project | |
|
53 | homepage: "" | |
|
54 | is_public: false | |
|
55 | identifier: private_child | |
|
56 | parent_id: 1 | |
|
57 | No newline at end of file |
@@ -63,6 +63,21 class ProjectsControllerTest < Test::Unit::TestCase | |||
|
63 | 63 | assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | def test_private_subprojects_hidden | |
|
67 | get :show, :id => 'ecookbook' | |
|
68 | assert_response :success | |
|
69 | assert_template 'show' | |
|
70 | assert_no_tag :tag => 'a', :content => /Private child/ | |
|
71 | end | |
|
72 | ||
|
73 | def test_private_subprojects_visible | |
|
74 | @request.session[:user_id] = 2 # manager who is a member of the private subproject | |
|
75 | get :show, :id => 'ecookbook' | |
|
76 | assert_response :success | |
|
77 | assert_template 'show' | |
|
78 | assert_tag :tag => 'a', :content => /Private child/ | |
|
79 | end | |
|
80 | ||
|
66 | 81 | def test_settings |
|
67 | 82 | @request.session[:user_id] = 2 # manager |
|
68 | 83 | get :settings, :id => 1 |
@@ -101,7 +101,7 class ProjectTest < Test::Unit::TestCase | |||
|
101 | 101 | assert sub.save |
|
102 | 102 | assert_equal @ecookbook.id, sub.parent.id |
|
103 | 103 | @ecookbook.reload |
|
104 |
assert_equal |
|
|
104 | assert_equal 4, @ecookbook.children.size | |
|
105 | 105 | end |
|
106 | 106 | |
|
107 | 107 | def test_subproject_invalid |
General Comments 0
You need to be logged in to leave comments.
Login now