Skip to content
Browse files

Allow detach_volume to take :force param as string or Boolean. Closes…

… #22.
  • Loading branch information...
1 parent 709ce65 commit 3f002783173a5c78c34a01f99d8a71488152d09e @grempe committed Jun 29, 2010
Showing with 17 additions and 1 deletion.
  1. +1 −1 lib/AWS/EC2/volumes.rb
  2. +16 −0 test/test_EC2_volumes.rb
View
2 lib/AWS/EC2/volumes.rb
@@ -88,7 +88,7 @@ def detach_volume( options = {} )
"VolumeId" => options[:volume_id],
"InstanceId" => options[:instance_id],
"Device" => options[:device],
- "Force" => options[:force]
+ "Force" => options[:force].to_s
}
return response_generator(:action => "DetachVolume", :params => params)
end
View
16 test/test_EC2_volumes.rb
@@ -139,4 +139,20 @@
response.status.should.equal "detaching"
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

0 comments on commit 3f00278

Please sign in to comment.
Something went wrong with that request. Please try again.