Skip to content

Instantly share code, notes, and snippets.

@joshaven
Created December 16, 2009 02:58
Show Gist options
  • Save joshaven/257555 to your computer and use it in GitHub Desktop.
Save joshaven/257555 to your computer and use it in GitHub Desktop.
From e5ae5bb8495ce28f8ac150bf340a3ce42d2ff34f Mon Sep 17 00:00:00 2001
From: Joshaven Potter <[email protected]>
Date: Tue, 15 Dec 2009 22:05:01 -0500
Subject: [PATCH] fix issue when S3Object is compaired to another type of object using the == method and associated test
---
lib/aws/s3/object.rb | 2 +-
test/object_test.rb | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/aws/s3/object.rb b/lib/aws/s3/object.rb
index bcdf9e1..b7e2f8a 100644
--- a/lib/aws/s3/object.rb
+++ b/lib/aws/s3/object.rb
@@ -584,7 +584,7 @@ module AWS
end
def ==(s3object) #:nodoc:
- path == s3object.path
+ s3object.is_a?(AWS::S3::S3Object) && path == s3object.path
end
def path #:nodoc:
diff --git a/test/object_test.rb b/test/object_test.rb
index f1094dc..cbf6c71 100644
--- a/test/object_test.rb
+++ b/test/object_test.rb
@@ -124,6 +124,7 @@ class ObjectTest < Test::Unit::TestCase
file1, file2 = Bucket.objects('does not matter')
assert file1 == file1
assert file2 == file2
+ assert file1 != :file2
assert !(file1 == file2) # /!\ Parens required /!\
end
--
1.6.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment