Sha256: 44e90367fa7cfc89a535092a5ef7f20c2846570233aeca06230af21848002816

Contents?: true

Size: 1.38 KB

Versions: 28

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class SettingsHelperTest < ViewTest
      include ERB::Util

      def test_sanitize_config_value
        assert(sanitize_config_value([]).blank?)
        assert(sanitize_config_value('').blank?)
        assert(sanitize_config_value(nil).blank?)

        assert_equal(
          '<code class="code code--block">foo</code>',
          sanitize_config_value('foo')
        )

        assert_equal(
          '<code class="code code--block">:foo</code>',
          sanitize_config_value(':foo')
        )

        assert_equal(
          '<code class="code code--block">3</code>',
          sanitize_config_value(3)
        )

        assert_equal(
          '<code class="code code--block">false</code>',
          sanitize_config_value(false)
        )

        assert_equal(
          '<code class="code code--block">30 days</code>',
          sanitize_config_value(30.days)
        )

        assert_match(
          /pre.*expandable.*code.*{\n.*foo.*bar.*\n.*}/,
          sanitize_config_value({ foo: 'bar' })
        )

        assert_match(
          /pre.*expandable.*code.*\[\n.*foo.*\n.*bar.*\n.*\]/,
          sanitize_config_value(['foo', 'bar'])
        )

        assert_match(
          /pre.*expandable.*code.*\[\n.*foo.*\n.*bar.*\n.*\]/,
          sanitize_config_value(SwappableList.new(['foo', 'bar']))
        )
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.26 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.25 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.23 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.22 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.21 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.20 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.19 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.18 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.17 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.16 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.15 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.14 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.13 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.12 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.11 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.10 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.9 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.8 test/helpers/workarea/admin/settings_helper_test.rb
workarea-admin-3.5.7 test/helpers/workarea/admin/settings_helper_test.rb