Sha256: 4eef7c509649e6a41a739b1aa0e1d79d4064c0d540237811a1a0966d87e916c2
Contents?: true
Size: 1.3 KB
Versions: 14
Compression:
Stored size: 1.3 KB
Contents
require File.dirname(__FILE__) + '/spec_helper.rb' def run_command eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin wd_role])) end describe 'wd role command' do before do ENV['WD_ROLES'] = nil end describe 'when no command-line arguments are specified' do before do Object.send(:remove_const, :ARGV) ARGV = [] end it 'should fail' do lambda { run_command }.should.raise(SystemExit) end end describe "when a role is specified on the command-line" do before do Object.send(:remove_const, :ARGV) ARGV = ['app'] end it 'should fail when no WD_ROLES environment setting is present' do ENV['WD_ROLES'] = nil lambda { run_command }.should.raise(SystemExit) end it 'should fail when an empty WD_ROLES environment setting is present' do ENV['WD_ROLES'] = '' lambda { run_command }.should.raise(SystemExit) end it 'should fail when the WD_ROLES environment setting does not contain that role' do ENV['WD_ROLES'] = 'web:nonapp:db' lambda { run_command }.should.raise(SystemExit) end it 'should succeed when the WD_ROLES environment setting contains that role' do ENV['WD_ROLES'] = 'web:app:db' lambda { run_command }.should.not.raise end end end
Version data entries
14 entries across 14 versions & 1 rubygems