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.9.5 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.9.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.9.3 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.9.2 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.9.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.8.1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.8.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.7 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.6 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.5 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.4 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.3 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.2 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.7.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.6.2 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.6.1 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.6.0 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.5.26 spec/unit/intercom/lib/flat_store_spec.rb
intercom-3.5.25 spec/unit/intercom/lib/flat_store_spec.rb