File: symbolize_keys_test.rb

package info (click to toggle)
ruby-glob 0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 200 kB
  • sloc: ruby: 449; makefile: 7; sh: 4
file content (21 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require "test_helper"

class SymbolizeKeysTest < Minitest::Test
  test "symbolizes hash" do
    input = {"a" => {"b" => 1}, 42 => "the answer"}
    expected = {a: {b: 1}, "42": "the answer"}
    actual = Glob::SymbolizeKeys.call(input)

    assert_equal expected, actual
  end

  test "symbolizes arrays" do
    input = [{"a" => {"b" => [1, 2, 3]}}]
    expected = [{a: {b: [1, 2, 3]}}]
    actual = Glob::SymbolizeKeys.call(input)

    assert_equal expected, actual
  end
end