Sha256: 9613c940cf026ca7673597431ddb91585efc2b22a5ca0fd455722c57a4f37ea6

Contents?: true

Size: 893 Bytes

Versions: 4

Compression:

Stored size: 893 Bytes

Contents

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

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

    should "normalize_opts should reject nil keys" do
      assert_raise { Screenbeacon::Util.normalize_opts(nil) }
      assert_raise { Screenbeacon::Util.normalize_opts(:api_id => nil, :api_token => nil) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
screenbeacon-1.0.2 test/screenbeacon/util_test.rb
screenbeacon-1.0.1 test/screenbeacon/util_test.rb
screenbeacon-1.0.0 test/screenbeacon/util_test.rb
screenbeacon-0.1.0 test/screenbeacon/util_test.rb