Sha256: 505ae346498ee8a0ece2ada44f685831028e2138c5d3dda0ab930ba3360fc551

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

require 'spec_helper'

describe Springboard::Client::Body do
  let(:hash) { {"key1" => "val1", "key2" => {"subkey1" => "subval1"}} }
  let(:body) { Springboard::Client::Body.new(hash)}

  describe "[]" do
    it "should support string keys" do
      body["key1"].should == "val1"
    end

    it "should support symbol keys" do
      body[:key1].should == "val1"
    end
  end

  describe "nested hashes" do
    it "should support nested indifferent access" do
      body[:key2][:subkey1].should == "subval1"
      body['key2']['subkey1'].should == "subval1"
      body[:key2]['subkey1'].should == "subval1"
      body['key2'][:subkey1].should == "subval1"
    end
  end

  describe "to_hash" do
    it "should return the original hash" do
      body.to_hash.should === hash
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
springboard-retail-4.0.0 spec/springboard/client/body_spec.rb