Sha256: 4cbd09d0dd81d03a68b4c587f87a3e5ec734a6d14a6bb6870fd887722fad494b

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe "Servers" do
  before(:each) do
    @stdout = []
    @stderr = []
    Runner.stubs(:log).with() { |msg,opts| @stdout <<  msg }
    Runner.stubs(:errorlog).with() { |msg,opts| @stderr <<  msg }
    Net::SSH::Gateway.stubs(:new).returns(SSHObject.new)
  end

  before(:all) do
    Net::SSH.stubs(:start).yields(SSHObject.new(:return_stream => :stdout, :return_data => "hostname = asdf\n"))
  end

  it "should complain if you do not provide an address" do
    lambda { Server.new(:name => :test) }.should raise_error(Screwcap::InvalidServer)
  end

  it "should complain if you do not provide a username" do
    lambda { Server.new(:name => :test, :address => "abc.com") }.should raise_error(Screwcap::InvalidServer)
  end

  it "should complain if a gateway contains more than one address" do
    lambda { Server.new(:name => :test, :addresses => ["abc.com", "def.com"], :user => "root", :is_gateway => true) }.should raise_error(Screwcap::InvalidServer)
  end

  it "should provide a connection to the server" do
    server = Server.new(:name => :test, :user => :root, :address => "abc.com")
    server.should respond_to(:__with_connection_for)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
screwcap-0.6.3 spec/server_spec.rb
screwcap-0.6.2 spec/server_spec.rb
screwcap-0.6.1 spec/server_spec.rb
screwcap-0.6 spec/server_spec.rb
screwcap-0.6.pre6 spec/server_spec.rb
screwcap-0.6.pre5 spec/server_spec.rb
screwcap-0.6.pre4 spec/server_spec.rb
screwcap-0.6.pre3 spec/server_spec.rb
screwcap-0.6.pre2 spec/server_spec.rb
screwcap-0.6.pre spec/server_spec.rb
screwcap-0.5 spec/server_spec.rb