spec/unit/lib/infrataster/server_spec.rb in infrataster-0.1.7 vs spec/unit/lib/infrataster/server_spec.rb in infrataster-0.1.8

- old
+ new

@@ -30,59 +30,46 @@ app_server = described_class.find_by_name('app') expect(app_server.from.name).to eq('proxy') end end - describe "#ssh_gateway" do - it "returns gateway instance and proc for finalizing" do - server = Server.new('name', 'address', ssh: {host: 'host', user: 'user'}) - - gateway_mock = double - expect(gateway_mock).to receive(:shutdown!) - expect(Net::SSH::Gateway).to receive(:new).and_return(gateway_mock) - gateway, finalize_proc = server.ssh_gateway - finalize_proc.call - expect(gateway).to eq(gateway_mock) - end - end - describe "#_ssh_start_args" do context "with ssh option" do context "when options[:ssh][:host] is set" do it 'returns args for SSH.start' do - server = Server.new('name', 'address', ssh: {host: 'host', user: 'user'}) + server = Server.new('name', 'address', ssh: {host_name: 'host', user: 'user'}) expect(server.send(:_ssh_start_args)). - to eq(['host', 'user', {host: 'host', user: 'user'}]) + to eq(['host', 'user', {host_name: 'host', user: 'user'}]) end end context "when options[:ssh][:host] is not set" do it 'returns args for SSH.start' do server = Server.new('name', 'address', ssh: {user: 'user'}) expect(server.send(:_ssh_start_args)). - to eq(['address', 'user', {host: 'address', user: 'user'}]) + to eq(['address', 'user', {host_name: 'address', user: 'user'}]) end end end context "with vagrant option" do context "when vagrant option is true" do it 'returns args for SSH.start' do server = Server.new('name', 'address', vagrant: true) expect(server).to receive(:ssh_config_for_vagrant).with('name'). - and_return({host: 'host', user: 'user'}) + and_return({host_name: 'host', user: 'user'}) expect(server.send(:_ssh_start_args)). - to eq(['host', 'user', {host: 'host', user: 'user'}]) + to eq(['host', 'user', {host_name: 'host', user: 'user'}]) end end context "when vagrant option is not true but truthy" do it 'returns args for SSH.start' do server = Server.new('name', 'address', vagrant: 'vagrant_vm_name') expect(server).to receive(:ssh_config_for_vagrant).with('vagrant_vm_name'). - and_return({host: 'host', user: 'user'}) + and_return({host_name: 'host', user: 'user'}) expect(server.send(:_ssh_start_args)). - to eq(['host', 'user', {host: 'host', user: 'user'}]) + to eq(['host', 'user', {host_name: 'host', user: 'user'}]) end end end context "otherwise" do