Sha256: 2664ee7fb39e9c0a587e7ef782cc245e65e8adadfccc24f62c51b127ccf776c6
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require_relative 'spec_helper' describe "Utility functions" do let(:utils) { Object.new.extend(Furoshiki::Util) } let(:hash_with_string_keys) { { 'one' => 1, :two => 2, 'three' => { 'a' => 'apple', :b => 'banana', 'c' => :cantaloupe } } } let(:hash_with_symbolized_keys) { { :one => 1, :two => 2, :three => { :a => 'apple', :b => 'banana', :c => :cantaloupe } } } let(:hash_of_defaults) { { :one => 'uno', :three => 'tres', :four => 'cuatro' } } let(:merged_hash_with_symbolized_keys) { { :one => 1, :two => 2, :three => { :a => 'apple', :b => 'banana', :c => :cantaloupe }, :four => 'cuatro' } } it "symbolizes hash keys" do symbolized = utils.deep_symbolize_keys(hash_with_string_keys) expect(symbolized).to eq(hash_with_symbolized_keys) end it "merges with hash of defaults" do merged = utils.merge_with_symbolized_keys(hash_of_defaults, hash_with_string_keys) expect(merged).to eq(merged_hash_with_symbolized_keys) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
furoshiki-0.3.1 | spec/util_spec.rb |
furoshiki-0.3.0 | spec/util_spec.rb |