summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-16 20:16:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-16 20:16:51 +0000
commite7400dfbba3eb0ea2b0483852939bf7c7f9920d6 (patch)
tree6452d6c4a811693e3c2565816c164fa594808a93 /test
parent23131d14f5ed86cac904a695df34dbcd011ecdd0 (diff)
downloadredmine-e7400dfbba3eb0ea2b0483852939bf7c7f9920d6.tar.gz
redmine-e7400dfbba3eb0ea2b0483852939bf7c7f9920d6.zip
Fix tests (#1565).
git-svn-id: http://svn.redmine.org/redmine/trunk@16415 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/my_controller_test.rb8
-rw-r--r--test/unit/helpers/my_helper_test.rb49
2 files changed, 6 insertions, 51 deletions
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