@@ -87,7 +87,7 class ProjectsController < ApplicationController | |||||
87 | def show |
|
87 | def show | |
88 | @custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position") |
|
88 | @custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position") | |
89 | @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} |
|
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 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
91 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | |
92 | @trackers = @project.rolled_up_trackers |
|
92 | @trackers = @project.rolled_up_trackers | |
93 |
|
93 |
@@ -24,4 +24,10 members_004: | |||||
24 | role_id: 2 |
|
24 | role_id: 2 | |
25 | # Locked user |
|
25 | # Locked user | |
26 | user_id: 5 |
|
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 | No newline at end of file |
|
33 |
@@ -3,7 +3,7 projects_001: | |||||
3 | created_on: 2006-07-19 19:13:59 +02:00 |
|
3 | created_on: 2006-07-19 19:13:59 +02:00 | |
4 | name: eCookbook |
|
4 | name: eCookbook | |
5 | updated_on: 2006-07-19 22:53:01 +02:00 |
|
5 | updated_on: 2006-07-19 22:53:01 +02:00 | |
6 |
projects_count: |
|
6 | projects_count: 3 | |
7 | id: 1 |
|
7 | id: 1 | |
8 | description: Recipes management application |
|
8 | description: Recipes management application | |
9 | homepage: http://ecookbook.somenet.foo/ |
|
9 | homepage: http://ecookbook.somenet.foo/ | |
@@ -43,3 +43,15 projects_004: | |||||
43 | is_public: true |
|
43 | is_public: true | |
44 | identifier: subproject2 |
|
44 | identifier: subproject2 | |
45 | parent_id: 1 |
|
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 | assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) |
|
63 | assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) | |
64 | end |
|
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 | def test_settings |
|
81 | def test_settings | |
67 | @request.session[:user_id] = 2 # manager |
|
82 | @request.session[:user_id] = 2 # manager | |
68 | get :settings, :id => 1 |
|
83 | get :settings, :id => 1 |
@@ -101,7 +101,7 class ProjectTest < Test::Unit::TestCase | |||||
101 | assert sub.save |
|
101 | assert sub.save | |
102 | assert_equal @ecookbook.id, sub.parent.id |
|
102 | assert_equal @ecookbook.id, sub.parent.id | |
103 | @ecookbook.reload |
|
103 | @ecookbook.reload | |
104 |
assert_equal |
|
104 | assert_equal 4, @ecookbook.children.size | |
105 | end |
|
105 | end | |
106 |
|
106 | |||
107 | def test_subproject_invalid |
|
107 | def test_subproject_invalid |
General Comments 0
You need to be logged in to leave comments.
Login now