##// END OF EJS Templates
Don't show the project dropdown when logging time on an issue....
Jean-Philippe Lang -
r10000:e06bf0c46418
parent child
Show More
@@ -3,7 +3,7
3 3
4 4 <div class="box tabular">
5 5 <% if @time_entry.new_record? %>
6 <% if params[:project_id] %>
6 <% if params[:project_id] || @time_entry.issue %>
7 7 <%= f.hidden_field :project_id %>
8 8 <% else %>
9 9 <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).all, :selected => @time_entry.project), :required => true %></p>
@@ -36,24 +36,22 class TimelogControllerTest < ActionController::TestCase
36 36 @response = ActionController::TestResponse.new
37 37 end
38 38
39 def test_get_new
39 def test_new_with_project_id
40 40 @request.session[:user_id] = 3
41 41 get :new, :project_id => 1
42 42 assert_response :success
43 43 assert_template 'new'
44 # Default activity selected
45 assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
46 :content => 'Development'
47 assert_select 'input[name=project_id][value=1]'
44 assert_select 'select[name=?]', 'time_entry[project_id]', 0
45 assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]'
48 46 end
49 47
50 def test_get_new_should_only_show_active_time_entry_activities
48 def test_new_with_issue_id
51 49 @request.session[:user_id] = 3
52 get :new, :project_id => 1
50 get :new, :issue_id => 2
53 51 assert_response :success
54 52 assert_template 'new'
55 assert_no_tag 'select', :attributes => {:name => 'time_entry[project_id]'}
56 assert_no_tag 'option', :content => 'Inactive Activity'
53 assert_select 'select[name=?]', 'time_entry[project_id]', 0
54 assert_select 'input[name=?][value=1][type=hidden]', 'time_entry[project_id]'
57 55 end
58 56
59 57 def test_new_without_project
@@ -61,8 +59,8 class TimelogControllerTest < ActionController::TestCase
61 59 get :new
62 60 assert_response :success
63 61 assert_template 'new'
64 assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}
65 assert_select 'input[name=project_id]', 0
62 assert_select 'select[name=?]', 'time_entry[project_id]'
63 assert_select 'input[name=?]', 'time_entry[project_id]', 0
66 64 end
67 65
68 66 def test_new_without_project_should_prefill_the_form
@@ -73,7 +71,7 class TimelogControllerTest < ActionController::TestCase
73 71 assert_select 'select[name=?]', 'time_entry[project_id]' do
74 72 assert_select 'option[value=1][selected=selected]'
75 73 end
76 assert_select 'input[name=project_id]', 0
74 assert_select 'input[name=?]', 'time_entry[project_id]', 0
77 75 end
78 76
79 77 def test_new_without_project_should_deny_without_permission
@@ -84,6 +82,22 class TimelogControllerTest < ActionController::TestCase
84 82 assert_response 403
85 83 end
86 84
85 def test_new_should_select_default_activity
86 @request.session[:user_id] = 3
87 get :new, :project_id => 1
88 assert_response :success
89 assert_select 'select[name=?]', 'time_entry[activity_id]' do
90 assert_select 'option[selected=selected]', :text => 'Development'
91 end
92 end
93
94 def test_new_should_only_show_active_time_entry_activities
95 @request.session[:user_id] = 3
96 get :new, :project_id => 1
97 assert_response :success
98 assert_no_tag 'option', :content => 'Inactive Activity'
99 end
100
87 101 def test_get_edit_existing_time
88 102 @request.session[:user_id] = 2
89 103 get :edit, :id => 2, :project_id => nil
General Comments 0
You need to be logged in to leave comments. Login now