"Fossies" - the Fresh Open Source Software Archive

Member "redmine-4.1.1/test/unit/lib/redmine/export/pdf/issues_pdf_test.rb" (6 Apr 2020, 2095 Bytes) of package /linux/www/redmine-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "issues_pdf_test.rb": 4.1.0_vs_4.1.1.

    1 # frozen_string_literal: true
    2 
    3 # Redmine - project management software
    4 # Copyright (C) 2006-2019  Jean-Philippe Lang
    5 #
    6 # This program is free software; you can redistribute it and/or
    7 # modify it under the terms of the GNU General Public License
    8 # as published by the Free Software Foundation; either version 2
    9 # of the License, or (at your option) any later version.
   10 #
   11 # This program is distributed in the hope that it will be useful,
   12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 # GNU General Public License for more details.
   15 #
   16 # You should have received a copy of the GNU General Public License
   17 # along with this program; if not, write to the Free Software
   18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   19 
   20 require File.expand_path('../../../../../../test_helper', __FILE__)
   21 
   22 class IssuesPdfHelperTest < ActiveSupport::TestCase
   23   fixtures :users, :projects, :roles, :members, :member_roles,
   24            :enabled_modules, :issues, :trackers, :enumerations
   25 
   26   include Redmine::Export::PDF::IssuesPdfHelper
   27 
   28   def test_fetch_row_values_should_round_float_values
   29     query = IssueQuery.new(:project => Project.find(1), :name => '_')
   30     query.column_names = [:subject, :spent_hours]
   31     issue = Issue.find(2)
   32     user = User.find(1)
   33     time_entry = TimeEntry.create!(:spent_on => Date.today, :hours => 4.3432, :user => user, :author => user,
   34                      :project_id => 1, :issue => issue, :activity => TimeEntryActivity.first)
   35 
   36     results = fetch_row_values(issue, query, 0)
   37     assert_equal ["2", "Add ingredients categories", "4.34"], results
   38   end
   39 
   40   def test_fetch_row_values_should_be_able_to_handle_parent_issue_subject
   41     query = IssueQuery.new(:project => Project.find(1), :name => '_')
   42     query.column_names = [:subject, 'parent.subject']
   43     issue = Issue.find(2)
   44     issue.parent = Issue.find(1)
   45     issue.save!
   46 
   47     results = fetch_row_values(issue, query, 0)
   48     assert_equal ['2', 'Add ingredients categories', 'Cannot print recipes'], results
   49   end
   50 end