on init, connect to AWS and check for the AS group
This commit is contained in:
@@ -10,13 +10,25 @@ describe 'aws-ha-release' do
|
||||
}
|
||||
end
|
||||
|
||||
let(:as) { AWS::FakeAutoScaling.new }
|
||||
|
||||
before do
|
||||
AWS.stub(:config)
|
||||
AWS::AutoScaling.stub(:new).and_return(AWS::FakeAutoScaling.new)
|
||||
AWS::AutoScaling.stub(:new).and_return(as)
|
||||
end
|
||||
|
||||
describe '#initialize' do
|
||||
it 'initializes the AWS connection'
|
||||
it 'ensures the as group exists'
|
||||
it 'initializes the AWS connection' do
|
||||
as.groups.create 'test_group'
|
||||
|
||||
AWS.should_receive(:config).with(access_key_id: 'testaccesskey', secret_access_key: 'testsecretkey', region: 'test-region')
|
||||
AwsHaRelease.new(opts)
|
||||
end
|
||||
|
||||
it 'ensures the as group exists' do
|
||||
lambda {
|
||||
AwsHaRelease.new(opts.merge!(as_group_name: 'fake_group'))
|
||||
}.should raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,5 +2,31 @@ module AWS
|
||||
class FakeAutoScaling
|
||||
def initialize
|
||||
end
|
||||
|
||||
def groups
|
||||
@groups ||= GroupCollection.new
|
||||
end
|
||||
|
||||
class GroupCollection
|
||||
def initialize
|
||||
@groups = {}
|
||||
end
|
||||
|
||||
def [](name)
|
||||
@groups[name]
|
||||
end
|
||||
|
||||
def create(name, options = {})
|
||||
@groups[name] = Group.new name
|
||||
end
|
||||
end
|
||||
|
||||
class Group
|
||||
attr_reader :name
|
||||
|
||||
def initialize(name)
|
||||
@name = name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user