Sha256: a3247af8340b62d5ca6c9f9d1a9ccb9ea6f33ddba4ebfd77f4ca542938f803f6

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

require "spec_helper"

describe BetterHelpers::NamespaceToHash do

  let :namespace do
    ["a", "b", "c"]
  end

  subject do
    BetterHelpers::NamespaceToHash.new(String, namespace).perform
  end

  it "should generate a nested hash resulting in the given object" do
    expect(subject).to be_an_instance_of Hash
    expect(subject.keys).to eql ["a"]

    expect(subject["a"]).to be_an_instance_of Hash
    expect(subject["a"].keys).to eql ["b"]

    expect(subject["a"]["b"]).to be_an_instance_of Hash
    expect(subject["a"]["b"].keys).to eql ["c"]
    expect(subject["a"]["b"]["c"]).to be_an_instance_of String
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
better_helpers-0.1.3 spec/better_helpers/namespace_to_hash_spec.rb