Sha256: 193d066d486363a5a26656ee29214b3e8491538006376f90ff74e696582b878a

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

module Capistrano
  class Configuration
    describe Server do
      let(:server) { Server.new('hostname') }

      describe 'adding a role' do
        subject { server.add_role(:test) }
        it 'adds the role' do
          expect{subject}.to change{server.roles.size}.from(0).to(1)
        end
      end

      describe 'checking roles' do
        subject { server.has_role?(:test) }

        before do
          server.add_role(:test)
        end

        it 'adds the role' do
          expect{subject}.to be_true
        end
      end

      describe 'comparing identity' do
        subject { server.matches? hostname }

        context 'with the same hostname' do
          let(:hostname) { 'hostname' }
          it { should be_true }
        end

        context 'with the same hostname and a user' do
          let(:hostname) { 'user@hostname' }
          it { should be_true }
        end

        context 'with a different hostname' do
          let(:hostname) { 'otherserver' }
          it { should be_false }
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-3.0.0.pre2 spec/lib/capistrano/configuration/server_spec.rb
capistrano-3.0.0.pre spec/lib/capistrano/configuration/server_spec.rb