Sha256: f60bbd1666015acb2d9f1c1605638831b8eb90a486d19698703037f658b00758

Contents?: true

Size: 1.69 KB

Versions: 19

Compression:

Stored size: 1.69 KB

Contents

require "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::SharedStorage.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

19 entries across 19 versions & 2 rubygems

Version Path
redcar-0.13 plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.5dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.4dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.3dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.2dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.1dev plugins/core/spec/core/shared_storage_spec.rb
redcar-0.12.1 plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.13.0dev plugins/core/spec/core/shared_storage_spec.rb
redcar-0.12 plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.27dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.26dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.25dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.24dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.23dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.22dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.21dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.20dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.19dev plugins/core/spec/core/shared_storage_spec.rb
redcar-dev-0.12.18dev plugins/core/spec/core/shared_storage_spec.rb