Sha256: 7104300b68b5780b990b00b686d92bffd0d92156edd5b7c6ae2e9f4951060e2b

Contents?: true

Size: 1.09 KB

Versions: 74

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module Appstats
  describe Host do

    before(:each) do
      Appstats::LogCollector.delete_all
      Appstats::Host.delete_all
      @host = Appstats::Host.new
    end
    
    describe "#initialize" do

      it "should set name to nil" do
        @host.name.should == nil
      end

      it "should set status to nil" do
        @host.status.should == nil
      end
      
      it "should set on constructor" do
        host = Appstats::Host.new(:name => 'a', :status => 'c')
        host.name.should == 'a'
        host.status.should == 'c'
      end
    
    end
    
    describe "#update_hosts" do
      
      it "should do nothing if no events" do
        Appstats::Host.update_hosts.should == 0
        Appstats::Host.count.should == 0
      end
      
      it "should add entry host names" do
        Appstats::LogCollector.create(:host => 'a')
        Appstats::Host.update_hosts.should == 1
        Appstats::Host.count.should == 1
        
        host = Appstats::Host.last
        host.name = 'a'
        host.status = 'derived'
      end
      
    end
    

  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
appstats-0.25.1 spec/host_spec.rb
appstats-0.25.0 spec/host_spec.rb
appstats-0.24.0 spec/host_spec.rb
appstats-0.23.5 spec/host_spec.rb
appstats-0.23.4 spec/host_spec.rb
appstats-0.23.3 spec/host_spec.rb
appstats-0.23.2 spec/host_spec.rb
appstats-0.23.1 spec/host_spec.rb
appstats-0.23.0 spec/host_spec.rb
appstats-0.22.6 spec/host_spec.rb
appstats-0.22.5 spec/host_spec.rb
appstats-0.22.4 spec/host_spec.rb
appstats-0.22.3 spec/host_spec.rb
appstats-0.22.2 spec/host_spec.rb
appstats-0.22.1 spec/host_spec.rb
appstats-0.22.0 spec/host_spec.rb
appstats-0.21.3 spec/host_spec.rb
appstats-0.21.2 spec/host_spec.rb
appstats-0.21.1 spec/host_spec.rb
appstats-0.20.12 spec/host_spec.rb