Sha256: 449ad95ca444e17251006df012fa820fde8ef9d7b45dcb8d8c5bdbcae7d5499f

Contents?: true

Size: 886 Bytes

Versions: 23

Compression:

Stored size: 886 Bytes

Contents

require "spec_helper"

describe Intercom::FlatStore do
  it "raises if you try to set or merge in nested hash structures" do
    data = Intercom::FlatStore.new()
    proc { data["thing"] = [1] }.must_raise ArgumentError
    proc { data["thing"] = {1 => 2} }.must_raise ArgumentError
    proc { Intercom::FlatStore.new({1 => {2 => 3}}) }.must_raise ArgumentError
  end

  it "raises if you try to use a non string key" do
    data =Intercom::FlatStore.new()
    proc { data[1] = "something" }.must_raise ArgumentError
  end

  it "sets and merges valid entries" do
    data = Intercom::FlatStore.new()
    data["a"] = 1
    data[:b] = 2
    data[:a].must_equal 1
    data["b"].must_equal 2
    data[:b].must_equal 2
    data = Intercom::FlatStore.new({"a" => 1, :b => 2})
    data["a"].must_equal 1
    data[:a].must_equal 1
    data["b"].must_equal 2
    data[:b].must_equal 2
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
intercom-1.0.0 spec/unit/intercom/flat_store_spec.rb
intercom-0.3.0 spec/unit/intercom/flat_store_spec.rb
intercom-0.2.3 spec/unit/intercom/flat_store_spec.rb
intercom-0.2.2 spec/unit/intercom/flat_store_spec.rb
intercom-0.2.1 spec/unit/intercom/flat_store_spec.rb
intercom-0.2.0 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.19 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.17 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.16 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.15 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.14 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.13 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.12 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.11 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.10 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.9 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.8 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.7 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.6 spec/unit/intercom/flat_store_spec.rb
intercom-0.1.5 spec/unit/intercom/flat_store_spec.rb