diff --git a/app/views/my/blocks/_timelog.html.erb b/app/views/my/blocks/_timelog.html.erb index da181c27e..350cbaec8 100644 --- a/app/views/my/blocks/_timelog.html.erb +++ b/app/views/my/blocks/_timelog.html.erb @@ -44,7 +44,7 @@ <%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %> <% entries_by_day[day].each do |entry| -%> - + <%= check_box_tag("ids[]", entry.id, false, :style => 'display:none;', :id => nil) %> <%= entry.activity %> diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index 5e3e9e940..92f5f8fa2 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -41,14 +41,18 @@ class MyControllerTest < Redmine::ControllerTest preferences = User.find(2).pref preferences[:my_page_layout] = {'top' => ['timelog']} preferences.save! - TimeEntry.create!(:user => User.find(2), :spent_on => Date.yesterday, :issue_id => 1, :hours => 2.5, :activity_id => 10) + with_issue = TimeEntry.create!(:user => User.find(2), :spent_on => Date.yesterday, :hours => 2.5, :activity_id => 10, :issue_id => 1) + without_issue = TimeEntry.create!(:user => User.find(2), :spent_on => Date.yesterday, :hours => 3.5, :activity_id => 10, :project_id => 1) get :page assert_response :success - assert_select 'tr.time-entry' do + assert_select "tr#time-entry-#{with_issue.id}" do assert_select 'td.subject a[href="/issues/1"]' assert_select 'td.hours', :text => '2.50' end + assert_select "tr#time-entry-#{without_issue.id}" do + assert_select 'td.hours', :text => '3.50' + end end def test_page_with_assigned_issues_block_and_no_custom_settings diff --git a/test/unit/helpers/my_helper_test.rb b/test/unit/helpers/my_helper_test.rb deleted file mode 100644 index d79525dd0..000000000 --- a/test/unit/helpers/my_helper_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2016 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -require File.expand_path('../../../test_helper', __FILE__) - -class MyHelperTest < Redmine::HelperTest - include ERB::Util - include MyHelper - - - fixtures :projects, :trackers, :issue_statuses, :issues, - :enumerations, :users, :issue_categories, - :projects_trackers, - :roles, - :member_roles, - :members, - :enabled_modules, - :versions - - def test_timelog_items_should_include_time_entries_without_issue - User.current = User.find(2) - entry = TimeEntry.generate!(:spent_on => Date.today, :user_id => 2, :project_id => 1) - assert_nil entry.issue - - assert_include entry, timelog_items.first - end - - def test_timelog_items_should_include_time_entries_with_issue - User.current = User.find(2) - entry = TimeEntry.generate!(:spent_on => Date.today, :user_id => 2, :project_id => 1, :issue_id => 1) - assert_not_nil entry.issue - - assert_include entry, timelog_items.first - end -end