diff --git a/app/models/middleware_server.rb b/app/models/middleware_server.rb index f6f6cc3378f..82dac446d65 100644 --- a/app/models/middleware_server.rb +++ b/app/models/middleware_server.rb @@ -42,11 +42,11 @@ def in_domain? # Returns whether a server is immutable or not. # - # By default, we define all servers as being immutable, so that power - # operations are not allowed, and it is the provider responsability to + # By default, we define all servers as being mutable, so that power + # operations are allowed, and it is the provider responsability to # reimplement this method if necessary. def immutable? - true + properties['Immutable'] == 'true' end # Returns whether a server is immutable or not. diff --git a/spec/models/middleware_server_spec.rb b/spec/models/middleware_server_spec.rb index 06d339c5a8c..68c6c4232f5 100644 --- a/spec/models/middleware_server_spec.rb +++ b/spec/models/middleware_server_spec.rb @@ -27,8 +27,18 @@ end describe '#immutable?' do - it 'is always true' do - expect(server).to be_immutable + it 'is true if "Immutable" is set as true' do + subject.properties = { 'Immutable' => 'true' } + expect(subject).to be_immutable + end + + it 'is false if "Immutable" is set as false' do + subject.properties = { 'Immutable' => 'false' } + expect(subject).not_to be_immutable + end + + it 'is false if no keys are defined' do + expect(subject).not_to be_immutable end end