Fix tests for Redmine 4
This commit is contained in:
@@ -12,6 +12,13 @@ env:
|
|||||||
sudo: true
|
sudo: true
|
||||||
cache: bundler
|
cache: bundler
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
webhooks:
|
||||||
|
urls:
|
||||||
|
secure: "lwJzu9BU7AVhHnROzEA6agagwsqVAaTzgtvwTlw4CwSUv0ypNXNi9kjJUvOgSit3BnkSccC9xYlYNOYw5OOmsmjyUDU4/LUVqd0DRQjW3FXU9EFFPGQq9srJikHOHobfnutxGwMYFE4ftLI08PzsL7bYEg39Ps3pwwWsiIKnKKI0DPmdQH5PzC63jF/EByrLZsfqGHOirgXDnxmwgmrQ14vOpp3lHjgNgx9wNALpSgAztKeK1Wd8KayLYXweu+LQx9IwJfLqvk6hhWW15vjkIhvK7ooYSGXx+Hlwg3jyFSyX5jButUT4vwlWdJeAoNO/sWpdKXv4AifGXYsbcF/LMHCaaVgwBm/pe/YlK2LrqFlpm7MFuqyO1w4AnIA7rC8wZp/dUU5bJITZgN3sTAbLyTIbF8cbMfbDy3IWP8Oub7K/0ATUD7vNBVuyxfdGG61xOv/RDQhzrGwUArJ/xJfdU77MZkQUnaGb0vcwmRLIxyPdZWPz9ntzCbBxFblPWApCw+CWOeM3OuR6tdVqSVuZx3aG87TTzW+S9lLe8PJ5HYgA6+rPkc04zolJMftnFVlUl3LQIKvV2QkPSnr9bcePR5YSoJJKLBVofUsg/btVkQ1OxhWn53Td/nQp7u8qosmyQjCjMiP6Po1e9Enr89FY8Yxkw2dQba5sumQRbB39bj0="
|
||||||
|
on_success: change
|
||||||
|
on_failure: always
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
postgresql: "9.6"
|
postgresql: "9.6"
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ class CommonViewsTest < Redmine::IntegrationTest
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
RedmineMessenger::TestCase.prepare
|
RedmineMessenger::TestCase.prepare
|
||||||
|
|
||||||
@request = ActionController::TestRequest.new
|
|
||||||
@response = ActionController::TestResponse.new
|
|
||||||
@request.env['HTTP_REFERER'] = '/'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'View user' do
|
test 'View user' do
|
||||||
|
|||||||
@@ -36,10 +36,6 @@ module RedmineMessenger
|
|||||||
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime, true)
|
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.arrays_equal?(a1, a2)
|
|
||||||
(a1 - a2) - (a2 - a1) == []
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.create_fixtures(fixtures_directory, table_names, _class_names = {})
|
def self.create_fixtures(fixtures_directory, table_names, _class_names = {})
|
||||||
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, _class_names = {})
|
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, _class_names = {})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +1,38 @@
|
|||||||
require File.expand_path('../../test_helper', __FILE__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
module Redmine
|
class I18nTest < ActiveSupport::TestCase
|
||||||
class I18nTest < ActiveSupport::TestCase
|
include Redmine::I18n
|
||||||
include Redmine::I18n
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
set_language_if_valid 'en'
|
set_language_if_valid 'en'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_valid_languages
|
def test_valid_languages
|
||||||
assert valid_languages.is_a?(Array)
|
assert valid_languages.is_a?(Array)
|
||||||
assert valid_languages.first.is_a?(Symbol)
|
assert valid_languages.first.is_a?(Symbol)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_locales_validness
|
def test_locales_validness
|
||||||
lang_files_count = Dir[Rails.root.join('plugins',
|
lang_files_count = Dir[Rails.root.join('plugins',
|
||||||
'redmine_messenger',
|
'redmine_messenger',
|
||||||
'config',
|
'config',
|
||||||
'locales',
|
'locales',
|
||||||
'*.yml')].size
|
'*.yml')].size
|
||||||
assert_equal lang_files_count, 3
|
assert_equal lang_files_count, 3
|
||||||
valid_languages.each do |lang|
|
valid_languages.each do |lang|
|
||||||
assert set_language_if_valid(lang)
|
assert set_language_if_valid(lang)
|
||||||
end
|
|
||||||
# check if parse error exists
|
|
||||||
::I18n.locale = 'de'
|
|
||||||
assert_equal 'Messenger Benutzer', l(:label_settings_messenger_username)
|
|
||||||
::I18n.locale = 'en'
|
|
||||||
assert_equal 'Messenger username', l(:label_settings_messenger_username)
|
|
||||||
::I18n.locale = 'ja'
|
|
||||||
assert_equal 'メッセンジャーのユーザー名', l(:label_settings_messenger_username)
|
|
||||||
set_language_if_valid('en')
|
|
||||||
end
|
end
|
||||||
|
# check if parse error exists
|
||||||
|
::I18n.locale = 'de'
|
||||||
|
assert_equal 'Messenger Benutzer', l(:label_settings_messenger_username)
|
||||||
|
::I18n.locale = 'en'
|
||||||
|
assert_equal 'Messenger username', l(:label_settings_messenger_username)
|
||||||
|
::I18n.locale = 'ja'
|
||||||
|
assert_equal 'メッセンジャーのユーザー名', l(:label_settings_messenger_username)
|
||||||
|
set_language_if_valid('en')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user