File: string_keyed_spec.rb

package info (click to toggle)
ruby-snaky-hash 2.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,156 kB
  • sloc: ruby: 1,298; javascript: 529; makefile: 4; sh: 4
file content (23 lines) | stat: -rw-r--r-- 560 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
22
23
# frozen_string_literal: true

RSpec.describe SnakyHash::StringKeyed do
  subject(:instance) do
    described_class.new(base_hash)
  end

  include_context "base hash"

  it_behaves_like "a snaky hash instance"

  it "can transform keys to string" do
    skip_for(
      engine: "ruby",
      versions: %w(2.2.10 2.3.8 2.4.10),
      reason: "transform_keys is not available in these versions of Ruby",
    )
    a = described_class.new(asd: "asd")
    b = a.transform_keys(&:to_s)
    expect(b.keys).to eq(["asd"])
    expect(b["asd"]).to eq("asd")
  end
end