Sha256: 8cee11fa199b29873f87bf2e0224684f9c10f2eb2e7a995df45a8f615cd7994b

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

require 'spec_helper'

describe Waistband::StringifyAll do

  before do
    Array.send(:include, Waistband::StringifyAll::Array)
    Hash.send(:include, Waistband::StringifyAll::Hash)
  end

  it "stringifies everything in an array" do
    [1, 2, 3].stringify_all.should eql %w(1 2 3)
  end

  it "stringifies everything in a hash" do
    {'name' => :peter, 'description' => {'full' => 'ok'}}.stringify_all.should eql({'name' => 'peter', 'description' => "{\"full\"=>\"ok\"}"})
  end

  it "recurses" do
    {'name' => :peter, 'description' => [1, 2, 3]}.stringify_all.should eql({'name' => 'peter', 'description' => "[1, 2, 3]"})
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
waistband-0.1.1 spec/lib/stringify_all_spec.rb
waistband-0.0.15 spec/lib/stringify_all_spec.rb