Sha256: 7e8d7be4f1714f9f063bd9fea489e6cb29a8acc1164294af9024a37fb1ac7e82

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'helper'

describe Scales::Config do
  
  before(:each) do
    described_class.reset!
  end
  
  it "should have default values" do
    Scales.config.should_not be_nil
    Scales.config.host.should == "localhost"
    Scales.config.port.should == 6379
  end
  
  it "should be able to write new values" do
    Scales.config.test.should be_nil
    Scales.config.test = "a new values"
    Scales.config.test.should == "a new values"
  end
  
  context "loading cache.yml" do
    
    it "loads cache.yml if it exists" do
      in_app_folder do
        Scales.env = "production"
        Scales.config.host.should == "123.123.123.123"
        Scales.config.port.should == 6380
        Scales.config.password.should == "secret"
        Scales.config.database.should == 5
      end
    end
    
    it "sticks with the defaults if it doesn't" do
      Scales.env = "production"
      Scales.config.host.should == "localhost"
      Scales.config.port.should == 6379
      Scales.config.password.should be_nil
      Scales.config.database.should == 0
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scales-core-0.0.4 spec/config_spec.rb
scales-core-0.0.1.beta.2 spec/config_spec.rb
scales-core-0.0.1.beta.1 spec/config_spec.rb