Sha256: 9043d402feab249b177776dcd21be51e235307a39326507b9acc040c0955569e

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

require 'spec_helper'

describe Billsafe do
  
  let(:deflattened_hash) do
    {
      "items" => {
        "0" => "ruby",
        "1" => "bi",
        "nested" => {
          "0" => "ruby"
        }
      },
      "status" => "OK"
    }
  end
  
  let(:flattened_hash) do
    { 
      "items_0" => "ruby", 
      "items_1" => "bi", 
      "items_nested_0"=>"ruby",
      "status" => "OK"
    }
  end
  
  it "should flatten params" do
    Billsafe.send(:flatten_params, deflattened_hash).should eql(flattened_hash)
  end

  it "should deflatten params" do
    Billsafe.send(:deflatten_params, flattened_hash).should eql(deflattened_hash)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
billsafe-0.2.1 spec/billsafe_spec.rb
billsafe-0.2.0 spec/billsafe_spec.rb