Sha256: bf2d4bf6da3812688f12be7cc5609a287199fbbe7340e559a6bd26a8788e13ef

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe TimedConfig do
  
  after(:all) do
    FileUtils.rm "#{$root}/spec/fixtures/config.yml"
  end
  
  it "should not have set a config" do
    TimedConfig.config.should == nil
  end
  
  it "should update config when path set" do
    write_to_fixture "test: test"
    TimedConfig.path = "#{$root}/spec/fixtures/config.yml"
    TimedConfig.config.should == { 'test' => 'test' }
  end
  
  it "should update config when period set" do
    write_to_fixture "test2: test2"
    TimedConfig.period = 2
    TimedConfig.config.should == { 'test2' => 'test2' }
  end
  
  it "should not update config in one second" do
    write_to_fixture "test3: test3"
    sleep 1
    TimedConfig.config.should == { 'test2' => 'test2' }
  end
  
  it "should update config in two seconds" do
    sleep 1
    TimedConfig.config.should == { 'test3' => 'test3' }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timed_config-0.1.1 spec/timed_config_spec.rb