Fix functional tests

This commit is contained in:
Alexander Meindl 2018-07-15 13:14:41 +02:00
parent 8cff63239a
commit 3baf0fd662
11 changed files with 28 additions and 8 deletions

View File

@ -1,5 +1,6 @@
sudo: false
language: ruby
cache: bundler
rvm:
- 2.2.7
- 2.3.4

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class AccountControllerTest < ActionController::TestCase
class AccountControllerTest < Additionals::ControllerTest
fixtures :users, :email_addresses, :roles
def setup

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class AdditionalsAssignToMeControllerTest < ActionController::TestCase
class AdditionalsAssignToMeControllerTest < Additionals::ControllerTest
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class AdditionalsChangeStatusControllerTest < ActionController::TestCase
class AdditionalsChangeStatusControllerTest < Additionals::ControllerTest
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class IssuesControllerTest < ActionController::TestCase
class IssuesControllerTest < Additionals::ControllerTest
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class ProjectsControllerTest < ActionController::TestCase
class ProjectsControllerTest < Additionals::ControllerTest
fixtures :projects,
:users,
:roles,

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class UsersControllerTest < ActionController::TestCase
class UsersControllerTest < Additionals::ControllerTest
fixtures :projects,
:users,
:roles,

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class WelcomeControllerTest < ActionController::TestCase
class WelcomeControllerTest < Additionals::ControllerTest
fixtures :projects, :news, :users, :members
def setup

View File

@ -1,6 +1,6 @@
require File.expand_path('../../test_helper', __FILE__)
class WikiControllerTest < ActionController::TestCase
class WikiControllerTest < Additionals::ControllerTest
fixtures :projects,
:users,
:roles,

View File

@ -6,12 +6,17 @@ class JavascriptLibraryTest < Redmine::IntegrationTest
assert_response :success
assert_select 'link[rel=stylesheet][href^=?]', '/plugin_assets/additionals/stylesheets/fontawesome-all.min.css'
return unless Redmine::Plugin.installed?('redmine_reporting')
assert_select 'link[rel=stylesheet][href^=?]', '/plugin_assets/additionals/stylesheets/nv.d3.min.css', count: 1
end
def test_not_loaded_css_libraries
get '/'
assert_response :success
return if Redmine::Plugin.installed?('redmine_reporting')
assert_select 'link[rel=stylesheet][href^=?]', '/plugin_assets/additionals/stylesheets/nv.d3.min.css', count: 0
end

View File

@ -17,6 +17,20 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
# Additionals helper class for tests
module Additionals
class ControllerTest < ActionController::TestCase
# can be removed if Redmine 3.4 and higher is supported only
def process(action, http_method = 'GET', *args)
parameters, _session, _flash = *args
if args.size == 1 && parameters[:xhr] == true
xhr http_method.downcase.to_sym, action, parameters.except(:xhr)
elsif parameters && (parameters.key?(:params) || parameters.key?(:session) || parameters.key?(:flash))
super action, http_method, parameters[:params], parameters[:session], parameters[:flash]
else
super
end
end
end
class TestCase
include ActionDispatch::TestProcess
def self.plugin_fixtures(plugin, *fixture_names)