1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

spec: match server different ports

This commit is contained in:
Malik Baktiyarov 2015-09-10 18:09:23 +03:00
parent 739ad5f31a
commit 7e8e2392c6
2 changed files with 9 additions and 7 deletions

View file

@ -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

View file

@ -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