mock-aws-s3 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.3.0
@@ -12,6 +12,14 @@ module AWS
12
12
  Value.new OpenStruct.new(:body=>data)
13
13
  end
14
14
 
15
+ def find(key, bucket = nil)
16
+ raise NoSuchKey.new("No such key `#{key}'", bucket) unless exists?(key, bucket)
17
+ bucket = Bucket.new(:name => bucket)
18
+ object = bucket.new_object
19
+ object.key = key
20
+ object
21
+ end
22
+
15
23
  # def stream(key, bucket = nil, options = {}, &block)
16
24
  # data = File.open(path!(bucket, key, options)) {|f| f.read}
17
25
  # Value.new Response.new(:body=>data)
@@ -20,19 +28,6 @@ module AWS
20
28
  # end
21
29
  # end
22
30
 
23
- # # Returns the object whose key is <tt>name</tt> in the specified bucket. If the specified key does not
24
- # # exist, a NoSuchKey exception will be raised.
25
- # def find(key, bucket = nil)
26
- # key = key.remove_extended unless key.valid_utf8?
27
- # bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)
28
- # # If our heuristic failed, trigger a NoSuchKey exception
29
- # if (object = bucket.objects.first) && object.key == key
30
- # object
31
- # else
32
- # raise NoSuchKey.new("No such key `#{key}'", bucket)
33
- # end
34
- # end
35
-
36
31
 
37
32
  # Makes a copy of the object with <tt>key</tt> to <tt>copy_key</tt>, preserving the ACL of the existing object if the <tt>:copy_acl</tt> option is true (default false).
38
33
  def copy(key, copy_key, bucket = nil, options = {})
data/mock-aws-s3.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mock-aws-s3}
8
- s.version = "0.1.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joshua Krall"]
12
- s.date = %q{2010-10-01}
12
+ s.date = %q{2010-10-07}
13
13
  s.description = %q{A Mock AWS::S3 so you can use it in your tests without hitting the network.}
14
14
  s.email = %q{joshuakrall@pobox.com}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.homepage = %q{http://github.com/jkrall/mock-aws-s3}
33
33
  s.rdoc_options = ["--charset=UTF-8"]
34
34
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
35
+ s.rubygems_version = %q{1.3.6}
36
36
  s.summary = %q{A Mock AWS::S3 so you can use it in your tests without hitting the network}
37
37
  s.test_files = [
38
38
  "spec/mock-aws-s3_spec.rb",
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
44
  s.specification_version = 3
45
45
 
46
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
47
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
48
48
  else
49
49
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
Binary file
@@ -73,6 +73,14 @@ describe "Mock::AWS::S3" do
73
73
  AWS::S3::S3Object.value('key', 'bucket')
74
74
  end
75
75
  end
76
+ describe '#find' do
77
+ before(:each) { create_test_file 'key' }
78
+ after(:each) { remove_test_file 'key' }
79
+ it 'should not do an actual request' do
80
+ AWS::S3::Base.should_not_receive(:get)
81
+ AWS::S3::S3Object.find('key', 'bucket')
82
+ end
83
+ end
76
84
  end
77
85
 
78
86
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock-aws-s3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
7
+ - 3
9
8
  - 0
10
- version: 0.1.0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Joshua Krall
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-01 00:00:00 -05:00
17
+ date: 2010-10-07 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 13
30
27
  segments:
31
28
  - 1
32
29
  - 2
@@ -65,27 +62,23 @@ rdoc_options:
65
62
  require_paths:
66
63
  - lib
67
64
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
65
  requirements:
70
66
  - - ">="
71
67
  - !ruby/object:Gem::Version
72
- hash: 3
73
68
  segments:
74
69
  - 0
75
70
  version: "0"
76
71
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
72
  requirements:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
81
- hash: 3
82
75
  segments:
83
76
  - 0
84
77
  version: "0"
85
78
  requirements: []
86
79
 
87
80
  rubyforge_project:
88
- rubygems_version: 1.3.7
81
+ rubygems_version: 1.3.6
89
82
  signing_key:
90
83
  specification_version: 3
91
84
  summary: A Mock AWS::S3 so you can use it in your tests without hitting the network