From 4d82cf5b1aa67bdad834be47ac1ac7820e3c7f74 Mon Sep 17 00:00:00 2001 From: Lee Hambley Date: Tue, 28 May 2013 16:23:47 +0200 Subject: [PATCH] Fix tests for a problem occuring with a specific test order. --- spec/lib/capistrano/dsl/env_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/lib/capistrano/dsl/env_spec.rb b/spec/lib/capistrano/dsl/env_spec.rb index 5822b686..002d1130 100644 --- a/spec/lib/capistrano/dsl/env_spec.rb +++ b/spec/lib/capistrano/dsl/env_spec.rb @@ -5,42 +5,47 @@ module Capistrano describe Env do - let(:env) { Configuration.env } + let(:env) { Configuration.new } describe '#role' do + it 'can add a role, with hosts' do env.role(:app, %w{example.com}) env.roles_for(:app).first.hostname.should == "example.com" end + it 'handles de-duplification within roles' do env.role(:app, %w{example.com}) env.role(:app, %w{example.com}) env.roles_for(:app).length.should == 1 end + it 'accepts instances of server objects' do pending env.role(:app, [Capistrano::Configuration::Server.new('example.net'), 'example.com']) env.roles_for(:app).length.should == 2 end + it 'accepts non-enumerable types' do env.role(:app, 'example.com') env.roles_for(:app).length.should == 1 end + end describe '#server' do + it "can create a server with properties" do env.server('example.com', roles: [:app, "web"], my: :value) env.roles_for(:app).first.hostname.should == 'example.com' env.roles_for(:web).first.hostname.should == 'example.com' env.roles_for(:all).first.properties.my.should == :value end + end describe '#roles' do - let(:env) { Configuration.env } - before do env.server('example.com', roles: :app, active: true) env.server('example.org', roles: :app)