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
(cherry picked from commit 16c4345)

https://bugzilla.redhat.com/show_bug.cgi?id=1446387
  • Loading branch information
blomquisg authored and simaishi committed Apr 27, 2017
1 parent b82c87a commit d1f6888
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 d1f6888

Please sign in to comment.