Sha256: 95239fe54c1a7a53a2ad917480e1b2779947dc7a5eb234990c7449a9f9b0bb87

Contents?: true

Size: 1.72 KB

Versions: 16

Compression:

Stored size: 1.72 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")

describe Redcar::Plugin::SharedStorage do
  
  before do
    remove_test_files
  end
  
  after do
    remove_test_files
  end
  
  def remove_test_files
    FileUtils.rm_rf(Redcar::Plugin::Storage.new('test_shared_storage').send(:path))
  end
  
  it "should set the default when it is not already set and the value is an Array" do
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', ['b', 'c'])
    storage['a'].should == ['b', 'c']
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage['a'].should == ['b', 'c']
  end
  
  it "should set the default when it is not already and the value is not an Array" do
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', 'b')
    storage['a'].should == ['b']
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage['a'].should == ['b']
  end
  
  it "should update the default when it is already set and the value is an Array" do
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', 'b')
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', 'c')
    storage['a'].should == ['b', 'c']
  end
  
  it "should update the default when it is already set and the value is not an Array" do
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', 'b')
    storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
    storage.set_or_update_default('a', ['c', 'd'])
    storage['a'].should == ['b', 'c', 'd']
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
redcar-dev-0.12.16dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.15dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.14dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.13dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.12dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.11dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.10dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.9dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.8dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.7dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.6dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.4dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.3dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.1dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.0dev-java plugins/core/spec/core/shared_storage_spec.rb
redcar-0.11 plugins/core/spec/core/shared_storage_spec.rb