Sha256: 196e8c226bb0dcc976a2f858b53c3f9161b1b3ff3c2b10fa9050e32a01e3a221

Contents?: true

Size: 849 Bytes

Versions: 14

Compression:

Stored size: 849 Bytes

Contents

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

module Stripe
  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 = Stripe::Util.symbolize_names(start)
      assert_equal(finish, symbolized)
    end

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stripe-1.29.1 test/stripe/util_test.rb
stripe-1.29.0 test/stripe/util_test.rb
stripe-1.28.1 test/stripe/util_test.rb
stripe-1.28.0 test/stripe/util_test.rb
stripe-1.27.2 test/stripe/util_test.rb
stripe-1.27.1 test/stripe/util_test.rb
stripe-1.27.0 test/stripe/util_test.rb
stripe-1.26.0 test/stripe/util_test.rb
stripe-1.25.0 test/stripe/util_test.rb
stripe-1.24.0 test/stripe/util_test.rb
stripe-1.23.0 test/stripe/util_test.rb
stripe-1.22.0 test/stripe/util_test.rb
stripe-1.21.0 test/stripe/util_test.rb
stripe-1.20.4 test/stripe/util_test.rb