').html_safe?
+ assert_not f('').html_safe?
end
unless ENV['NON_LOCALIZED'] # localization dependent tests
@@ -123,74 +126,88 @@ def format_string_size(obj)
test 'format integer column' do
m = crud_test_models(:AAAAA)
+
assert_equal '9', format_type(m, :children)
m.children = 10_000
+
assert_equal '10'000', format_type(m, :children)
end
unless ENV['NON_LOCALIZED'] # localization dependent tests
test 'format float column' do
m = crud_test_models(:AAAAA)
+
assert_equal '1.10', format_type(m, :rating)
m.rating = 3.145001 # you never know with these floats..
+
assert_equal '3.15', format_type(m, :rating)
end
test 'format decimal column' do
m = crud_test_models(:AAAAA)
+
assert_equal '10'000'000.1111', format_type(m, :income)
end
test 'format date column' do
m = crud_test_models(:AAAAA)
+
assert_equal 'Sa, 01.01.1910', format_type(m, :birthdate)
end
test 'format datetime column' do
m = crud_test_models(:AAAAA)
+
assert_equal '01.01.2010 11:21', format_type(m, :last_seen)
end
end
test 'format time column' do
m = crud_test_models(:AAAAA)
+
assert_equal '01:01', format_type(m, :gets_up_at)
end
test 'format text column' do
m = crud_test_models(:AAAAA)
+
assert_equal "AAAAA BBBBB CCCCC\n
AAAAA BBBBB CCCCC\n
",
format_type(m, :remarks)
- assert format_type(m, :remarks).html_safe?
+ assert_predicate format_type(m, :remarks), :html_safe?
end
test 'format boolean false column' do
m = crud_test_models(:AAAAA)
m.human = false
+
assert_equal 'nein', format_type(m, :human)
end
test 'format boolean true column' do
m = crud_test_models(:AAAAA)
m.human = true
+
assert_equal 'ja', format_type(m, :human)
end
test 'format belongs to column without content' do
m = crud_test_models(:AAAAA)
+
assert_equal t('global.associations.no_entry'),
format_attr(m, :companion)
end
test 'format belongs to column with content' do
m = crud_test_models(:BBBBB)
+
assert_equal 'AAAAA', format_attr(m, :companion)
end
test 'format has_many column with content' do
m = crud_test_models(:CCCCC)
+
assert_equal '',
format_attr(m, :others)
end
@@ -199,6 +216,6 @@ def format_string_size(obj)
assert_equal 'Camel Case', captionize(:camel_case)
assert_equal 'All Upper Case', captionize('all upper case')
assert_equal 'With Object', captionize('With object', Object.new)
- assert !captionize('bad ').html_safe?
+ assert_not captionize('bad ').html_safe?
end
end
diff --git a/test/helpers/i18n_helper_test.rb b/test/helpers/i18n_helper_test.rb
index 653ff4254..ec5593be4 100644
--- a/test/helpers/i18n_helper_test.rb
+++ b/test/helpers/i18n_helper_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of
# PuzzleTime and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
@@ -17,42 +19,49 @@ class I18nHelperTest < ActionView::TestCase
I18n.locale,
global: { test_key: 'global' }
)
+
assert_equal 'global', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
list: { global: { test_key: 'list global' } }
)
+
assert_equal 'list global', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
list: { index: { test_key: 'list index' } }
)
+
assert_equal 'list index', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
crud: { global: { test_key: 'crud global' } }
)
+
assert_equal 'crud global', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
crud: { index: { test_key: 'crud index' } }
)
+
assert_equal 'crud index', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
crud_test_models: { global: { test_key: 'test global' } }
)
+
assert_equal 'test global', ti(:test_key)
I18n.backend.store_translations(
I18n.locale,
crud_test_models: { index: { test_key: 'test index' } }
)
+
assert_equal 'test index', ti(:test_key)
end
@@ -63,6 +72,7 @@ class I18nHelperTest < ActionView::TestCase
I18n.locale,
global: { associations: { test_key: 'global' } }
)
+
assert_equal 'global', ta(:test_key, assoc)
I18n.backend.store_translations(
@@ -75,6 +85,7 @@ class I18nHelperTest < ActionView::TestCase
}
}
)
+
assert_equal 'model', ta(:test_key, assoc)
I18n.backend.store_translations(
@@ -91,6 +102,7 @@ class I18nHelperTest < ActionView::TestCase
}
}
)
+
assert_equal 'companion', ta(:test_key, assoc)
assert_equal 'global', ta(:test_key)
diff --git a/test/helpers/order_controlling_helper_test.rb b/test/helpers/order_controlling_helper_test.rb
index fd7e45bdc..a5a2cc473 100644
--- a/test/helpers/order_controlling_helper_test.rb
+++ b/test/helpers/order_controlling_helper_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Copyright (c) 2006-2018, Puzzle ITC GmbH. This file is part of
# PuzzleTime and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
@@ -37,10 +39,10 @@ def setup
test '#controlling_chart_datasets' do
assert_equal [
- { 'label': 'Verrechenbar', 'data': [10, 10, 20], 'backgroundColor': '#69B978' },
- { 'label': 'Nicht verrechenbar', 'data': [5, 5, 8], 'backgroundColor': '#f0e54e' },
- { 'label': 'Definitiv geplant', 'data': [0, 0, 2], 'backgroundColor': '#4286e7' },
- { 'label': 'Provisorisch geplant', 'data': [0, 0, 0], 'backgroundColor': '#9bcbd4' }
+ { label: 'Verrechenbar', data: [10, 10, 20], backgroundColor: '#69B978' },
+ { label: 'Nicht verrechenbar', data: [5, 5, 8], backgroundColor: '#f0e54e' },
+ { label: 'Definitiv geplant', data: [0, 0, 2], backgroundColor: '#4286e7' },
+ { label: 'Provisorisch geplant', data: [0, 0, 0], backgroundColor: '#9bcbd4' }
].to_json, controlling_chart_datasets
end
end
diff --git a/test/helpers/table_helper_test.rb b/test/helpers/table_helper_test.rb
index 80dda28f2..bed58c42c 100644
--- a/test/helpers/table_helper_test.rb
+++ b/test/helpers/table_helper_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of
# PuzzleTime and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
@@ -39,27 +41,30 @@ def can?(_action, _resource)
test 'empty table should render message' do
result = plain_table_or_message([]) {}
- assert result.html_safe?
- assert_match /\