Skip to content

Commit

Permalink
Merge pull request #14822 from cfcosta/fix-immutability-defaults-for-ms
Browse files Browse the repository at this point in the history
Fix defaults for immutability of MiddlewareServers
  • Loading branch information
blomquisg committed Apr 25, 2017
2 parents 6e30194 + be1592d commit 16c4345
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/models/middleware_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions spec/models/middleware_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 16c4345

Please sign in to comment.