additionals/test/test_helper.rb

45 lines
1.0 KiB
Ruby
Raw Normal View History

2018-05-21 13:43:42 +03:00
$VERBOSE = nil
if ENV['COVERAGE']
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')
require File.expand_path(File.dirname(__FILE__) + '/global_test_helper')
2017-06-28 17:19:58 +03:00
2018-07-23 18:26:52 +03:00
if defined?(RSpec)
RSpec.configure do |config|
config.mock_with :mocha
config.example_status_persistence_file_path = Rails.root.join('tmp/additionals_rspec_examples.txt')
2018-07-23 18:26:52 +03:00
end
end
module Additionals
2018-07-15 19:02:52 +03:00
module TestHelper
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|
r.permissions << :view_issues
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
2018-07-23 19:17:04 +03:00
class ControllerTest < Redmine::ControllerTest
include Additionals::TestHelper
end
class TestCase < ActiveSupport::TestCase
include Additionals::TestHelper
end
end