Sha256: 21c9d9ebbc81760d231d4cb43bbf5370131cdbb2c746fbc3b81c6b688f9e4b86

Contents?: true

Size: 777 Bytes

Versions: 6

Compression:

Stored size: 777 Bytes

Contents

require 'test/unit'
require 'radius'

class RadiusUtilityTest < Test::Unit::TestCase
  
  def test_symbolize_keys
    h = Radius::Utility.symbolize_keys({ 'a' => 1, :b => 2 })
    assert_equal h[:a], 1
    assert_equal h[:b], 2
  end
  
  def test_impartial_hash_delete
    h = { 'a' => 1, :b => 2 }
    assert_equal Radius::Utility.impartial_hash_delete(h, :a), 1
    assert_equal Radius::Utility.impartial_hash_delete(h, 'b'), 2
    assert_equal h.empty?, true
  end
  
  def test_constantize
    assert_equal Radius::Utility.constantize('String'), String
  end
  
  def test_camelize
    assert_equal Radius::Utility.camelize('ab_cd_ef'), 'AbCdEf'
  end

  def test_array_to_s
    assert_equal Radius::Utility.array_to_s(['a', 1, [:c], 'brain'.freeze]), 'a1cbrain'
  end
end

Version data entries

6 entries across 5 versions & 3 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/radius-0.7.5/test/utility_test.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/radius-0.7.5/test/utility_test.rb
radius-0.7.5 test/utility_test.rb
radius-0.7.4 test/utility_test.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/radius-0.7.3/test/utility_test.rb
radius-0.7.3 test/utility_test.rb