Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Commit

Permalink
Allow detach_volume to take :force param as string or Boolean. Closes
Browse files Browse the repository at this point in the history
…#22.
  • Loading branch information
grempe committed Jun 29, 2010
1 parent 709ce65 commit 3f00278
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/AWS/EC2/volumes.rb
Expand Up @@ -88,7 +88,7 @@ def detach_volume( options = {} )
"VolumeId" => options[:volume_id], "VolumeId" => options[:volume_id],
"InstanceId" => options[:instance_id], "InstanceId" => options[:instance_id],
"Device" => options[:device], "Device" => options[:device],
"Force" => options[:force] "Force" => options[:force].to_s
} }
return response_generator(:action => "DetachVolume", :params => params) return response_generator(:action => "DetachVolume", :params => params)
end end
Expand Down
16 changes: 16 additions & 0 deletions test/test_EC2_volumes.rb
Expand Up @@ -139,4 +139,20 @@
response.status.should.equal "detaching" response.status.should.equal "detaching"
end end


specify "should be able to be force detached with a string" do
@ec2.stubs(:make_request).with('DetachVolume', {"VolumeId" => "vol-4d826724", "InstanceId"=>"i-6058a509", "Device"=>"", "Force"=>"true"}).
returns stub(:body => @detach_volume_response_body, :is_a? => true)

response = @ec2.detach_volume( :volume_id => "vol-4d826724", :instance_id => "i-6058a509", :force => 'true' )
response.volumeId.should.equal "vol-4d826724"
end

specify "should be able to be force detached with a Boolean" do
@ec2.stubs(:make_request).with('DetachVolume', {"VolumeId" => "vol-4d826724", "InstanceId"=>"i-6058a509", "Device"=>"", "Force"=>"true"}).
returns stub(:body => @detach_volume_response_body, :is_a? => true)

response = @ec2.detach_volume( :volume_id => "vol-4d826724", :instance_id => "i-6058a509", :force => true )
response.volumeId.should.equal "vol-4d826724"
end

end end

0 comments on commit 3f00278

Please sign in to comment.