Nagios Service class.

This commit is contained in:
Felipe Oliveira 2012-12-07 16:40:40 -02:00
parent 125025e078
commit 86f8428c41
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,12 @@
module NSCA
module Client
class Service
attr_accessor :name, :host
def initialize(options)
@name = options[:name]
@host = options[:host] || Host.current
end
end
end
end

View file

@ -0,0 +1,16 @@
require 'spec_helper'
describe NSCA::Client::Service do
let(:host) { NSCA::Client::Host.new(:hostname => 'asdf') }
subject { described_class.new(:name => 'TestMessage', :host => host) }
its(:name) { should eq 'TestMessage' }
its(:host) { should eq host }
context "default host to current machine" do
subject { described_class.new(:name => 'SimpleMessage') }
its(:name) { should eq 'SimpleMessage' }
its(:host) { should be_a NSCA::Client::Host }
end
end