Skip to content

Commit

Permalink
Reworked Vbd api to check if is a disk
Browse files Browse the repository at this point in the history
  • Loading branch information
plribeiro3000 committed Sep 9, 2014
1 parent ada2ce6 commit b0d9ce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/fog/compute/xen_server/models/vbd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def unplug
false
end

def is_disk?
def disk?
type == 'Disk'
end

def destroy
if is_disk?
if disk?
unplug
vdi.destroy
end
Expand Down
6 changes: 3 additions & 3 deletions spec/fog/compute/xen_server/models/vbd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ def service.unplug_vbd(reference); true end
end
end

describe '#is_disk?' do
describe '#disk?' do
describe 'on a disk' do
before :each do
vbd.type = 'Disk'
end

it 'should return true' do
vbd.is_disk?.must_equal(true)
vbd.disk?.must_equal(true)
end
end

Expand All @@ -163,7 +163,7 @@ def service.unplug_vbd(reference); true end
end

it 'should return false' do
vbd.is_disk?.must_equal(false)
vbd.disk?.must_equal(false)
end
end
end
Expand Down

0 comments on commit b0d9ce5

Please sign in to comment.