Sha256: 5abc8fae9611b20eac09989b0195de3c006a5598d80f72c8d291f1845b2e755c

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe LitmusPaper do
  describe 'configure' do
    it 'populates services from the config file' do
      LitmusPaper.configure(TEST_CONFIG)
      LitmusPaper.services.has_key?('test').should == true
    end
  end

  describe "reload" do
    it "will reconfigure the services" do
      LitmusPaper.configure(TEST_CONFIG)
      LitmusPaper.services["bar"] = :service

      LitmusPaper.reload

      LitmusPaper.services.has_key?('bar').should == false
      LitmusPaper.services.has_key?('test').should == true
    end

    it "keeps the old config if there are errors in the new config" do
      old_config_file = SpecHelper.create_temp_file(<<-END)
        service :old_service do |s|
          s.measure_health Metric::CPULoad, :weight => 100
        end
      END
      new_bad_config_file = SpecHelper.create_temp_file(<<-END)
        service :old_service do |s|
          syntax error here
        end
      END
      LitmusPaper.configure(old_config_file)
      LitmusPaper.services.keys.should == ["old_service"]
      LitmusPaper.configure(new_bad_config_file)
      LitmusPaper.services.keys.should == ["old_service"]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
litmus_paper-0.3.3 spec/litmus_paper_spec.rb
litmus_paper-0.3.2 spec/litmus_paper_spec.rb
litmus_paper-0.3.1 spec/litmus_paper_spec.rb
litmus_paper-0.3.0 spec/litmus_paper_spec.rb
litmus_paper-0.1.0 spec/litmus_paper_spec.rb
litmus_paper-0.0.3 spec/litmus_paper_spec.rb