Commit 07f6a6f3 authored by jplang's avatar jplang
Browse files

Fix tests (#1565).

git-svn-id: https://svn.redmine.org/redmine/trunk@16415 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent af71aac1
......@@ -44,7 +44,7 @@
<td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td>
</tr>
<% entries_by_day[day].each do |entry| -%>
<tr class="time-entry hascontextmenu">
<tr id="time-entry-<%= entry.id %>" class="time-entry hascontextmenu">
<td class="activity">
<%= check_box_tag("ids[]", entry.id, false, :style => 'display:none;', :id => nil) %>
<%= entry.activity %>
......
......@@ -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
......
# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment