mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
Fix tests (#1565).
git-svn-id: http://svn.redmine.org/redmine/trunk@16415 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
23131d14f5
commit
e7400dfbba
@ -44,7 +44,7 @@
|
|||||||
<td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td>
|
<td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% entries_by_day[day].each do |entry| -%>
|
<% 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">
|
<td class="activity">
|
||||||
<%= check_box_tag("ids[]", entry.id, false, :style => 'display:none;', :id => nil) %>
|
<%= check_box_tag("ids[]", entry.id, false, :style => 'display:none;', :id => nil) %>
|
||||||
<%= entry.activity %>
|
<%= entry.activity %>
|
||||||
|
|||||||
@ -41,14 +41,18 @@ class MyControllerTest < Redmine::ControllerTest
|
|||||||
preferences = User.find(2).pref
|
preferences = User.find(2).pref
|
||||||
preferences[:my_page_layout] = {'top' => ['timelog']}
|
preferences[:my_page_layout] = {'top' => ['timelog']}
|
||||||
preferences.save!
|
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
|
get :page
|
||||||
assert_response :success
|
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.subject a[href="/issues/1"]'
|
||||||
assert_select 'td.hours', :text => '2.50'
|
assert_select 'td.hours', :text => '2.50'
|
||||||
end
|
end
|
||||||
|
assert_select "tr#time-entry-#{without_issue.id}" do
|
||||||
|
assert_select 'td.hours', :text => '3.50'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_page_with_assigned_issues_block_and_no_custom_settings
|
def test_page_with_assigned_issues_block_and_no_custom_settings
|
||||||
|
|||||||
@ -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
|
|
||||||
Loading…
x
Reference in New Issue
Block a user