Sha256: 143814732545b21502825b43eb2d1e16c9aa3b1568c193aa824cc6c99bc4b2e4

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

require 'spec_helper'

describe SonJay::ObjectModel::ExtraData do

  it "provides value access by name symbol or string" do
    subject[ :aaa  ] = 1
    subject[ 'bbb' ] = 2
    expect( subject[ 'aaa' ] ).to eq( 1 )
    expect( subject[ :bbb  ] ).to eq( 2 )
  end

  it "merges with a hash, returning a hash" do
    subject[ :aa  ] = 1
    subject[ :bb  ] = 2

    actual = subject.hash_merge(
      "bb" => 22,
      "cc" => 33
    )

    expect( actual ).to eq(
      'aa' => 1,
      'bb' => 22,
      'cc' => 33
    )
  end

  it "indicates when it is empty" do
    expect( subject ).to be_empty
  end

  it "indicates when it is not empty" do
    subject[:a] = 'a'
    expect( subject ).not_to be_empty
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
son_jay-0.4.1 spec/object_model/extra_data_spec.rb
son_jay-0.4.0 spec/object_model/extra_data_spec.rb