mock-aws-s3 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,9 +10,11 @@ From there on, all (supported) calls to AWS::S3::S3Object will be proxied to fil
10
10
 
11
11
  AWS::S3::S3Object.store 'key', 'some data', 'bucket'
12
12
  AWS::S3::S3Object.exists?('key', 'bucket')
13
+ AWS::S3::S3Object.value 'key', 'bucket'
14
+ AWS::S3::S3Object.url_for 'key', 'bucket'
13
15
  AWS::S3::S3Object.delete('key', 'bucket')
14
16
 
15
- ... will result in a file being created on disk at <tt>./tmp/mock-aws-s3/bucket/key</tt>, with contents: <tt>"some data"</tt>. A <tt>File.exists?()</tt> check will be performed on that file, and then it will be deleted.
17
+ ... will result in a file being created on disk at <tt>./tmp/mock-aws-s3/bucket/key</tt>, with contents: <tt>"some data"</tt>. A <tt>File.exists?()</tt> check will be performed on that file, the content of the file will be returned, a local file uri will be return and then it will be deleted.
16
18
 
17
19
  If you are using Rails, the <tt>Rails.root</tt> directory will be used: <tt>Rails.root.join('tmp')</tt>.
18
20
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -12,6 +12,10 @@ module AWS
12
12
  Value.new OpenStruct.new(:body=>data)
13
13
  end
14
14
 
15
+ def url_for(key, bucket = nil)
16
+ "file://#{File.expand_path(path!(bucket, key))}"
17
+ end
18
+
15
19
  def find(key, bucket = nil)
16
20
  raise NoSuchKey.new("No such key `#{key}'", bucket) unless exists?(key, bucket)
17
21
  bucket = Bucket.new(:name => bucket)
@@ -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.3.0"
8
+ s.version = "0.4.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-07}
12
+ s.date = %q{2010-11-11}
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 = [
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "lib/mock/aws/s3/object.rb",
26
26
  "mock-aws-s3.gemspec",
27
27
  "pkg/mock-aws-s3-0.1.0.gem",
28
+ "pkg/mock-aws-s3-0.4.0.gem",
28
29
  "spec/mock-aws-s3_spec.rb",
29
30
  "spec/spec.opts",
30
31
  "spec/spec_helper.rb"
@@ -32,7 +33,7 @@ Gem::Specification.new do |s|
32
33
  s.homepage = %q{http://github.com/jkrall/mock-aws-s3}
33
34
  s.rdoc_options = ["--charset=UTF-8"]
34
35
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.6}
36
+ s.rubygems_version = %q{1.3.7}
36
37
  s.summary = %q{A Mock AWS::S3 so you can use it in your tests without hitting the network}
37
38
  s.test_files = [
38
39
  "spec/mock-aws-s3_spec.rb",
@@ -43,7 +44,7 @@ Gem::Specification.new do |s|
43
44
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
45
  s.specification_version = 3
45
46
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
48
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
48
49
  else
49
50
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
Binary file
@@ -81,6 +81,18 @@ describe "Mock::AWS::S3" do
81
81
  AWS::S3::S3Object.find('key', 'bucket')
82
82
  end
83
83
  end
84
+ describe '#url_for' do
85
+ before(:each) { create_test_file 'key' }
86
+ after(:each) { remove_test_file 'key' }
87
+ it 'should not do an actual request' do
88
+ AWS::S3::Base.should_not_receive(:get)
89
+ AWS::S3::S3Object.url_for('key', 'bucket')
90
+ end
91
+ it 'should return a local file uri' do
92
+ url = AWS::S3::S3Object.url_for('key', 'bucket')
93
+ url.should == 'file://' + File.expand_path(File.dirname(__FILE__) + '/../tmp/mock-aws-s3/bucket/key')
94
+ end
95
+ end
84
96
  end
85
97
 
86
98
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock-aws-s3
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 15
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 3
8
+ - 4
8
9
  - 0
9
- version: 0.3.0
10
+ version: 0.4.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Joshua Krall
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-07 00:00:00 -05:00
18
+ date: 2010-11-11 00:00:00 -06:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -49,6 +52,7 @@ files:
49
52
  - lib/mock/aws/s3/object.rb
50
53
  - mock-aws-s3.gemspec
51
54
  - pkg/mock-aws-s3-0.1.0.gem
55
+ - pkg/mock-aws-s3-0.4.0.gem
52
56
  - spec/mock-aws-s3_spec.rb
53
57
  - spec/spec.opts
54
58
  - spec/spec_helper.rb
@@ -62,23 +66,27 @@ rdoc_options:
62
66
  require_paths:
63
67
  - lib
64
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
65
70
  requirements:
66
71
  - - ">="
67
72
  - !ruby/object:Gem::Version
73
+ hash: 3
68
74
  segments:
69
75
  - 0
70
76
  version: "0"
71
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
72
79
  requirements:
73
80
  - - ">="
74
81
  - !ruby/object:Gem::Version
82
+ hash: 3
75
83
  segments:
76
84
  - 0
77
85
  version: "0"
78
86
  requirements: []
79
87
 
80
88
  rubyforge_project:
81
- rubygems_version: 1.3.6
89
+ rubygems_version: 1.3.7
82
90
  signing_key:
83
91
  specification_version: 3
84
92
  summary: A Mock AWS::S3 so you can use it in your tests without hitting the network