Sha256: edb6d3ac93c166472a532225a8eb3b0d3312441aac6d8c0d9c3ea947efcf475b

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

module Payjp
  class UtilTest < Test::Unit::TestCase
    should "symbolize_names should convert names to symbols" do
      start = {
        'foo' => 'bar',
        'array' => [{ 'foo' => 'bar' }],
        'nested' => {
          1 => 2,
          :symbol => 9,
          'string' => nil
        }
      }
      finish = {
        :foo => 'bar',
        :array => [{ :foo => 'bar' }],
        :nested => {
          1 => 2,
          :symbol => 9,
          :string => nil
        }
      }

      symbolized = Payjp::Util.symbolize_names(start)
      assert_equal(finish, symbolized)
    end

    should "normalize_opts should reject nil keys" do
      assert_raise { Payjp::Util.normalize_opts(nil) }
      assert_raise { Payjp::Util.normalize_opts(:api_key => nil) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
payjp-0.0.5 test/payjp/util_test.rb
payjp-0.0.4 test/payjp/util_test.rb
payjp-0.0.3 test/payjp/util_test.rb
payjp-0.0.2 test/payjp/util_test.rb