From 6c7814d75492ad6e8cbb44996ce9eb1240756d36 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Fri, 7 Dec 2012 16:36:46 -0200 Subject: [PATCH] Remote server class that represents NSCA Host. --- lib/nsca/client/remote_server.rb | 12 ++++++++++++ spec/nsca/client/remote_server_spec.rb | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 lib/nsca/client/remote_server.rb create mode 100644 spec/nsca/client/remote_server_spec.rb diff --git a/lib/nsca/client/remote_server.rb b/lib/nsca/client/remote_server.rb new file mode 100644 index 0000000..422550c --- /dev/null +++ b/lib/nsca/client/remote_server.rb @@ -0,0 +1,12 @@ +module NSCA + module Client + class RemoteServer + attr_reader :host, :port + + def initialize(options) + @host = options[:host] + @port = options[:port] || 5667 + end + end + end +end diff --git a/spec/nsca/client/remote_server_spec.rb b/spec/nsca/client/remote_server_spec.rb new file mode 100644 index 0000000..3b38651 --- /dev/null +++ b/spec/nsca/client/remote_server_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe NSCA::Client::RemoteServer do + subject { described_class.new(:host => '172.0.0.1') } + its(:host) { should eq '172.0.0.1' } + its(:port) { should eq 5667 } + + context "custom port" do + subject { described_class.new(:port => 12345) } + its(:port) { should eq 12345 } + end +end