Sha256: b7cdd6931ec6daa466daa397b19d0324e540fda6fac23fd40a6d4413771a2ed5

Contents?: true

Size: 917 Bytes

Versions: 77

Compression:

Stored size: 917 Bytes

Contents

require "spec_helper"

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

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

  it "sets and merges valid entries" do
    data = Intercom::Lib::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::Lib::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

77 entries across 77 versions & 2 rubygems

Version Path
intercom-3.5.2 spec/unit/intercom/lib/flat_store_spec.rb
cogniteev-intercom-2.5.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.5.1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.4.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.3.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.2.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.1.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.6 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.5 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.3 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.2 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.0.0b1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.5.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.4.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.4.3 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.4.2 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.4.1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-2.4.0 spec/unit/intercom/lib/flat_store_spec.rb