Permalink
Browse files

removed flunk calls in favor of assertions.

  • Loading branch information...
1 parent c3327ae commit 65576c931710b71b972b6a92ef28a006856adc78 @wadewest committed Oct 16, 2010
Showing with 15 additions and 15 deletions.
  1. +15 −15 test/test_cloudapp_api.rb
View
@@ -2,36 +2,36 @@
class TestCloudAppAPI < Test::Unit::TestCase
- should "be able to create a client" do
- flunk "Couldn't create client." if client.nil?
+ should "be able to create a client" do
+ assert_instance_of CloudApp::Client, client, "Couldn't create client."
end
should "test retreiving a listing of my uploaded files." do
items = client.items
- unless items.class == ::Array
- flunk "Couldn't retrieve the items."
- end
+ assert_instance_of Array, items, "Couldn't retrieve the items."
end
should "test creating a bookmark" do
- unless client.bookmark("CloudApp","http://cloudapp.com").class == ::CloudApp::Item
- flunk "Failed to create a bookmark."
- end
+ b = client.bookmark("CloudApp","http://cloudapp.com")
+ assert_instance_of CloudApp::Item, b, "Failed to create a bookmark."
end
should "be able to delete an item" do
res = client.delete "rAnD"
- flunk "Couldn't delete an item" unless res === true
+ assert_same true, res, "Couldn't delete an item"
- res = client.delete "rAnD"
- flunk "Shouldn't be able to delete the same item" if !res.respond_to?(:code) && res.code != 404
+ bad_res = client.delete "rAnD"
+ message = "Shouldn't be able to delete the same item"
+ assert_not_same true, bad_res, message
+ assert bad_res.class == HTTParty::Response, message
+ # the above test passed, but the following wouldn't
+ # assert_instance_of HTTParty::Response, bad_res
+ # kept saying bad_res was nil. Could this be a bug?
end
should "be able to upload a file" do
- begin
- res = client.upload 'README.md'
- flunk "Couldn't upload the file" unless res.class == ::CloudApp::Item
- end
+ res = client.upload 'README.md'
+ assert_instance_of CloudApp::Item, res, "Couldn't upload the file"
end
### Can't think of any other test to add at the moment

0 comments on commit 65576c9

Please sign in to comment.