1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Use ruby-style attribute setters in AutoScaling::Group initializer

This commit is contained in:
David Faber 2013-09-19 15:53:12 -07:00
parent fa5d270915
commit ef47f6316e
2 changed files with 17 additions and 12 deletions

View file

@ -25,18 +25,18 @@ module Fog
attribute :vpc_zone_identifier, :aliases => 'VPCZoneIdentifier'
def initialize(attributes={})
attributes['DefaultCooldown'] ||= 300
attributes['DesiredCapacity'] ||= 0
attributes['EnabledMetrics'] ||= []
attributes['HealthCheckGracePeriod'] ||= 0
attributes['HealthCheckType'] ||= 'EC2'
attributes['Instances'] ||= []
attributes['LoadBalancerNames'] ||= []
attributes['MaxSize'] ||= 0
attributes['MinSize'] ||= 0
attributes['SuspendedProcesses'] ||= []
attributes['Tags'] ||= []
attributes['TerminationPolicies'] ||= ['Default']
attributes['Instances'] = []
self.default_cooldown = 300
self.desired_capacity = 0
self.enabled_metrics = []
self.health_check_grace_period = 0
self.health_check_type = 'EC2'
self.load_balancer_names = []
self.max_size = 0
self.min_size = 0
self.suspended_processes = []
self.tags = []
self.termination_policies = ['Default']
super
end

View file

@ -18,5 +18,10 @@ Shindo.tests('AWS::AutoScaling | group', ['aws', 'auto_scaling_m']) do
model_tests(Fog::AWS[:auto_scaling].groups, params, true) do
@instance.update
end
test("setting attributes in the constructor") do
group = Fog::AWS[:auto_scaling].groups.new(min_size: 1, max_size: 2)
group.min_size == 1 && group.max_size == 2
end
end