Sha256: 09c88c43ce00c36ab163cd7a5778f2d930c683b3872c4640198c06cf3ec86c04
Contents?: true
Size: 869 Bytes
Versions: 22
Compression:
Stored size: 869 Bytes
Contents
require 'spec_helper' describe Waistband::StringifiedHash do let(:hash) { Waistband::StringifiedHash.new } it "stringifies everything in a hash" do hash['name'] = :peter hash['description'] = {'full' => 'ok'} hash.stringify_all.should eql({'name' => 'peter', 'description' => "{\"full\"=>\"ok\"}"}) end it "recurses" do hash['name'] = :peter hash['description'] = [1, 2, 3] hash.stringify_all.should eql({'name' => 'peter', 'description' => "[1, 2, 3]"}) end it "creates a stringified array from a hash" do copy = Waistband::StringifiedHash.new_from({'name' => 'peter', 'description' => [1, 2, 3]}) copy.should be_a Waistband::StringifiedHash copy['name'].should eql 'peter' copy['description'].should eql [1, 2, 3] copy.stringify_all.should eql({'name' => 'peter', 'description' => "[1, 2, 3]"}) end end
Version data entries
22 entries across 22 versions & 1 rubygems