Sha256: 44e6efc4ad4746b27bf3305f9261af739e0e950bb61fb6392f5296fe498434aa

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 Bytes

Contents

require 'spec_helper'

describe Figleaf::Fighash do
  describe "#to_hash" do
    it "should return class Hash" do
      subject.to_hash.class.should == Hash
    end

    context "should have symbols as keys" do
      it "for symbol keys" do
        subject = described_class.new({ a: :b, c: 1, d: "foo" })
        subject.to_hash.should == { a: :b, c: 1, d: "foo" }
      end

      it "for string keys" do
        subject = described_class.new({ "a" => :b, "c" => 1, "d" => "foo" })
        subject.to_hash.should == { a: :b, c: 1, d: "foo" }
      end

      it "should have symbols as keys inside two levels" do
        subject = described_class.new({ a: { b: :d } })
        subject.to_hash.should == { a: { b: :d } }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
figleaf-0.2.9 spec/figleaf/fighash_spec.rb
figleaf-0.2.7 spec/figleaf/fighash_spec.rb
figleaf-0.2.6 spec/figleaf/fighash_spec.rb
figleaf-0.2.5 spec/figleaf/fighash_spec.rb
figleaf-0.2.4 spec/figleaf/fighash_spec.rb
figleaf-0.2.3 spec/figleaf/fighash_spec.rb
figleaf-0.2.2 spec/figleaf/fighash_spec.rb
figleaf-0.2.1 spec/figleaf/fighash_spec.rb
figleaf-0.2.0 spec/figleaf/fighash_spec.rb
figleaf-0.0.7 spec/figleaf/fighash_spec.rb
figleaf-0.0.6 spec/figleaf/fighash_spec.rb