From 7e8e2392c62b887dcf10a61a2bb2fed8cd54b180 Mon Sep 17 00:00:00 2001 From: Malik Baktiyarov Date: Thu, 10 Sep 2015 18:09:23 +0300 Subject: [PATCH] spec: match server different ports --- spec/integration/dsl_spec.rb | 14 ++++++++------ spec/lib/capistrano/configuration/servers_spec.rb | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/integration/dsl_spec.rb b/spec/integration/dsl_spec.rb index 92e12d01..000ce33e 100644 --- a/spec/integration/dsl_spec.rb +++ b/spec/integration/dsl_spec.rb @@ -273,22 +273,24 @@ describe Capistrano::DSL do end describe 'fetching all servers' do - it 'creates one server per hostname, ignoring user and port combinations' do - expect(dsl.roles(:all).size).to eq(1) + it 'creates one server per hostname, ignoring user combinations' do + expect(dsl.roles(:all).size).to eq(2) end end describe 'fetching servers for a role' do it 'roles defined using the `server` syntax are included' do as = dsl.roles(:web).map { |server| "#{server.user}@#{server.hostname}:#{server.port}" } - expect(as.size).to eq(1) - expect(as[0]).to eq("deployer@example1.com:5678") + expect(as.size).to eq(2) + expect(as[0]).to eq("deployer@example1.com:1234") + expect(as[1]).to eq("@example1.com:5678") end it 'roles defined using the `role` syntax are included' do as = dsl.roles(:app).map { |server| "#{server.user}@#{server.hostname}:#{server.port}" } - expect(as.size).to eq(1) - expect(as[0]).to eq("deployer@example1.com:5678") + expect(as.size).to eq(2) + expect(as[0]).to eq("deployer@example1.com:1234") + expect(as[1]).to eq("@example1.com:5678") end end diff --git a/spec/lib/capistrano/configuration/servers_spec.rb b/spec/lib/capistrano/configuration/servers_spec.rb index 6582524f..ef54b35e 100644 --- a/spec/lib/capistrano/configuration/servers_spec.rb +++ b/spec/lib/capistrano/configuration/servers_spec.rb @@ -140,7 +140,7 @@ module Capistrano servers.add_host('1', roles: [:app, 'web'], test: :value, user: 'root', port: 34) servers.add_host('1', roles: [:app, 'web'], test: :value, user: 'deployer', port: 34) servers.add_host('1', roles: [:app, 'web'], test: :value, user: 'deployer', port: 56) - expect(servers.count).to eq(1) + expect(servers.count).to eq(5) end describe "with a :user property" do