2021-04-18 14:34:55 +03:00
# frozen_string_literal: true
2020-08-08 18:53:49 +03:00
require File . expand_path '../../test_helper' , __FILE__
2019-06-13 20:33:59 +03:00
class AdditionalsTest < Additionals :: TestCase
fixtures :projects , :users , :members , :member_roles , :roles ,
:trackers , :projects_trackers ,
:enabled_modules ,
:enumerations
include Redmine :: I18n
def setup
prepare_tests
end
def test_true
assert Additionals . true? 1
assert Additionals . true? true
assert Additionals . true? 'true'
assert Additionals . true? 'True'
assert_not Additionals . true? ( - 1 )
assert_not Additionals . true? 0
assert_not Additionals . true? '0'
assert_not Additionals . true? 1000
assert_not Additionals . true? false
assert_not Additionals . true? 'false'
assert_not Additionals . true? 'False'
assert_not Additionals . true? 'yes'
assert_not Additionals . true? ''
assert_not Additionals . true? nil
assert_not Additionals . true? 'unknown'
end
def test_settings
2019-06-22 12:39:42 +03:00
assert_raises NoMethodError do
2019-10-02 10:24:03 +03:00
Additionals . settings [ :open_external_urls ]
2019-06-22 12:39:42 +03:00
end
2019-06-13 20:33:59 +03:00
end
def test_setting
2019-06-22 12:39:42 +03:00
assert_equal 'Don\'t forget to define acceptance criteria!' ,
Additionals . setting ( :new_ticket_message )
2019-10-02 10:24:03 +03:00
assert Additionals . setting? ( :open_external_urls )
2019-06-22 12:39:42 +03:00
assert_nil Additionals . setting ( :no_existing_key )
end
def test_setting_bool
2019-10-02 10:24:03 +03:00
assert Additionals . setting? ( :open_external_urls )
2019-06-13 20:33:59 +03:00
assert_not Additionals . setting? ( :add_go_to_top )
end
def test_load_macros
2020-11-29 15:17:02 +03:00
macros = Additionals . load_macros
2019-06-13 20:33:59 +03:00
2020-11-29 15:17:02 +03:00
assert macros . count . positive?
assert ( macros . detect { | macro | macro . include? 'fa_macro' } )
2019-06-13 20:33:59 +03:00
end
end