2018-05-21 13:43:42 +03:00
$VERBOSE = nil
2020-03-29 19:08:12 +03:00
if ENV [ 'JENKINS' ]
2017-09-30 07:31:45 +03:00
require 'simplecov'
SimpleCov . start :rails do
add_filter 'init.rb'
root File . expand_path ( File . dirname ( __FILE__ ) + '/..' )
end
2017-06-28 16:21:00 +03:00
end
2017-06-28 17:19:58 +03:00
require File . expand_path ( File . dirname ( __FILE__ ) + '/../../../test/test_helper' )
2018-07-24 17:28:23 +03:00
require File . expand_path ( File . dirname ( __FILE__ ) + '/global_test_helper' )
2017-06-28 17:19:58 +03:00
2017-06-07 20:23:20 +03:00
module Additionals
2018-07-15 19:02:52 +03:00
module TestHelper
2018-07-24 17:28:23 +03:00
include Additionals :: GlobalTestHelper
2016-10-19 14:30:14 +03:00
2018-07-23 19:17:04 +03:00
def prepare_tests
2016-10-19 14:30:14 +03:00
Role . where ( id : [ 1 , 2 ] ) . each do | r |
2020-07-27 11:49:23 +03:00
r . permissions << :save_dashboards
r . save
end
Role . where ( id : [ 1 ] ) . each do | r |
r . permissions << :manage_shared_dashboards
r . permissions << :set_system_dashboards
2016-10-19 14:30:14 +03:00
r . save
end
Project . where ( id : [ 1 , 2 ] ) . each do | project |
EnabledModule . create ( project : project , name : 'issue_tracking' )
end
end
end
2018-07-15 19:02:52 +03:00
2020-07-27 11:49:23 +03:00
module PluginFixturesLoader
def fixtures ( * table_names )
dir = File . dirname ( __FILE__ ) + '/fixtures/'
table_names . each do | x |
ActiveRecord :: FixtureSet . create_fixtures ( dir , x ) if File . exist? ( " #{ dir } / #{ x } .yml " )
end
super ( table_names )
end
end
2018-07-23 19:17:04 +03:00
class ControllerTest < Redmine :: ControllerTest
include Additionals :: TestHelper
2020-07-27 11:49:23 +03:00
extend PluginFixturesLoader
2018-07-23 19:17:04 +03:00
end
class TestCase < ActiveSupport :: TestCase
include Additionals :: TestHelper
2020-07-27 11:49:23 +03:00
extend PluginFixturesLoader
end
class IntegrationTest < Redmine :: IntegrationTest
extend PluginFixturesLoader
2018-07-23 19:17:04 +03:00
end
end