Sha256: 4733fbcce025c435bf3d7cc261cd45b92bba057825029c5e48c69ade8687f01f

Contents?: true

Size: 1.37 KB

Versions: 12

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe "Configuration" do 

  set :environment, ENV['RACK_ENV'] || :test

  before { 
    @cfg = Nagios::Config.new(Nagira.settings.nagios_cfg)
  }

  context "nagios.cfg" do

    it { File.should exist @cfg.path }
    
    it "should be parseable" do
      lambda { @cfg.parse }.should_not raise_error
    end

    context "parsing nagios.cfg file" do 

      before { @cfg.parse }
      
      it "should have PATH to objects file" do 
        @cfg.object_cache_file.should be_a_kind_of String 
      end
      
      it "should have PATH to status file" do
        @cfg.status_file.should be_a_kind_of String 
      end

    end # parsing nagios.cfg file
  end # nagios.cfg
  
  context "data files" do 
    before { @cfg.parse }
    
    context Nagios::Status do
      
      subject { Nagios::Status.new( Nagira.settings.status_cfg || @cfg.status_file ) }

      it { File.should exist( subject.path ) }
      
      it "should be parseable" do
        lambda { subject.parse }.should_not raise_error
      end
    end # Nagios::Status


    context Nagios::Objects do

      subject {  Nagios::Objects.new( Nagira.settings.objects_cfg || @cfg.object_cache_file) }

      it { File.should exist subject.path }
      
      it "should be parseable" do
        lambda { subject.parse }.should_not raise_error
      end
    end # Nagios::Objects

  end # data files

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nagira-0.3.3 spec/00_configuration_spec.rb
nagira-0.3.2 spec/00_configuration_spec.rb
nagira-0.3.1 spec/00_configuration_spec.rb
nagira-0.3.0 spec/00_configuration_spec.rb
nagira-0.2.12 spec/00_configuration_spec.rb
nagira-0.2.11 spec/00_configuration_spec.rb
nagira-0.2.10 spec/00_configuration_spec.rb
nagira-0.2.9 spec/00_configuration_spec.rb
nagira-0.2.8 spec/00_configuration_spec.rb
nagira-0.2.7 spec/00_configuration_spec.rb
nagira-0.2.6 spec/00_configuration_spec.rb
nagira-0.2.5 spec/00_configuration_spec.rb