carrierwave 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

data/README.rdoc CHANGED
@@ -23,7 +23,7 @@ Install the latest stable release:
23
23
  CarrierWave is hosted *only* on {Gemcutter}[http://gemcutter.org] as of version 0.4.0.
24
24
 
25
25
  In Merb, add it as a dependency to your config/dependencies.rb:
26
-
26
+
27
27
  dependency 'carrierwave'
28
28
 
29
29
  In Rails, add it to your environment.rb:
@@ -54,9 +54,9 @@ should look something like this:
54
54
  You can use your uploader class to store and retrieve files like this:
55
55
 
56
56
  uploader = AvatarUploader.new
57
-
57
+
58
58
  uploader.store!(my_file)
59
-
59
+
60
60
  uploader.retrieve_from_store!('my_file.png')
61
61
 
62
62
  CarrierWave gives you a +store+ for permanent storage, and a +cache+ for
@@ -74,6 +74,10 @@ need to require the relevant extension manually, e.g.:
74
74
 
75
75
  require 'carrierwave/orm/activerecord'
76
76
 
77
+ Add a string column to the model you want to mount the uploader on:
78
+
79
+ add_column :user, :avatar, :string
80
+
77
81
  Open your model file and mount the uploader:
78
82
 
79
83
  class User
@@ -125,12 +129,12 @@ example is image thumbnails. There is built in support for this:
125
129
  class MyUploader < CarrierWave::Uploader::Base
126
130
  include CarrierWave::RMagick
127
131
 
128
- process :resize => [800, 800]
132
+ process :resize_to_fit => [800, 800]
129
133
 
130
134
  version :thumb do
131
135
  process :resize_to_fill => [200,200]
132
136
  end
133
-
137
+
134
138
  end
135
139
 
136
140
  When this uploader is used, an uploaded image would be scaled to be no larger
@@ -139,7 +143,7 @@ and cropped to exactly 200 by 200 pixels. The uploader could be used like this:
139
143
 
140
144
  uploader = AvatarUploader.new
141
145
  uploader.store!(my_file) # size: 1024x768
142
-
146
+
143
147
  uploader.url # => '/url/to/my_file.png' # size: 800x600
144
148
  uploader.thumb.url # => '/url/to/thumb_my_file.png' # size: 200x200
145
149
 
@@ -282,7 +286,7 @@ And then in your uploader, set the storage to :s3
282
286
  That's it! You can still use the +CarrierWave::Uploader#url+ method to return
283
287
  the url to the file on Amazon S3.
284
288
 
285
- Alternatively, and especially if your bucket is located in Europe, you can use the
289
+ Alternatively, and especially if your bucket is located in Europe, you can use the
286
290
  RightAWS library by setting the storage to :right_s3
287
291
 
288
292
  class AvatarUploader < CarrierWave::Uploader::Base
@@ -337,10 +341,10 @@ file is uploaded.
337
341
 
338
342
  class AvatarUploader < CarrierWave::Uploader::Base
339
343
  include CarrierWave::RMagick
340
-
344
+
341
345
  process :resize_to_fill => [200, 200]
342
346
  process :convert => 'png'
343
-
347
+
344
348
  def filename
345
349
  super + '.png'
346
350
  end
@@ -355,7 +359,7 @@ ImageScience works the same way as RMagick.
355
359
 
356
360
  class AvatarUploader < CarrierWave::Uploader::Base
357
361
  include CarrierWave::ImageScience
358
-
362
+
359
363
  process :resize_to_fill => [200, 200]
360
364
  end
361
365
 
@@ -378,7 +382,7 @@ for the RMagick processor.
378
382
 
379
383
  class AvatarUploader < CarrierWave::Uploader::Base
380
384
  include CarrierWave::MiniMagick
381
-
385
+
382
386
  process :resize_to_fill => [200, 200]
383
387
  end
384
388
 
data/Rakefile CHANGED
@@ -25,8 +25,8 @@ $hoe = Hoe.spec 'carrierwave' do
25
25
  self.extra_dev_deps << ['sequel', '>=3.2.0']
26
26
  self.extra_dev_deps << ['rmagick', '>=2.10.0']
27
27
  self.extra_dev_deps << ['mini_magick', '>=1.2.5']
28
- self.extra_dev_deps << ['mongo_mapper', '>=0.5.8']
29
- self.extra_dev_deps << ['mongoid', '>=0.5.11']
28
+ self.extra_dev_deps << ['mongo_mapper', '>=0.6.8']
29
+ self.extra_dev_deps << ['mongoid', '>=0.9.9']
30
30
  self.extra_dev_deps << ['aws-s3', '>=0.6.2']
31
31
  self.extra_rdoc_files << 'README.rdoc'
32
32
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'activerecord'
3
+ require 'active_record'
4
4
  require 'carrierwave/mount'
5
5
  require 'carrierwave/orm/activerecord'
6
6
 
data/lib/carrierwave.rb CHANGED
@@ -7,7 +7,7 @@ require 'carrierwave/core_ext/inheritable_attributes'
7
7
 
8
8
  module CarrierWave
9
9
 
10
- VERSION = "0.4.2"
10
+ VERSION = "0.4.3"
11
11
 
12
12
  class << self
13
13
  attr_accessor :root
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'activerecord'
3
+ require 'active_record'
4
4
 
5
5
  module CarrierWave
6
6
  module ActiveRecord
@@ -254,18 +254,19 @@ module CarrierWave
254
254
  return name.downcase
255
255
  end
256
256
 
257
- def split_extension(fn)
257
+ def split_extension(filename)
258
258
  # regular expressions to try for identifying extensions
259
- ext_regexps = [
260
- /\A(.+)\.([^\.]{1,3}\.[^\.]{1,4})\z/, # matches "something.tar.gz"
259
+ extension_matchers = [
260
+ /\A(.+)\.(tar\.gz)\z/, # matches "something.tar.gz"
261
261
  /\A(.+)\.([^\.]+)\z/ # matches "something.jpg"
262
262
  ]
263
- ext_regexps.each do |regexp|
264
- if fn =~ regexp
263
+
264
+ extension_matchers.each do |regexp|
265
+ if filename =~ regexp
265
266
  return $1, $2
266
267
  end
267
268
  end
268
- return fn, "" # In case we weren't able to split the extension
269
+ return filename, "" # In case we weren't able to split the extension
269
270
  end
270
271
 
271
272
  end # SanitizedFile
@@ -96,7 +96,7 @@ module CarrierWave
96
96
  #
97
97
  def url
98
98
  if @uploader.s3_cnamed
99
- ["http://", @uploader.s3_bucket, @path].compact.join('/')
99
+ ["http://", @uploader.s3_bucket, "/", @path].compact.join
100
100
  else
101
101
  ["http://s3.amazonaws.com", @uploader.s3_bucket, @path].compact.join('/')
102
102
  end
@@ -3,7 +3,8 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
 
4
4
  require 'carrierwave/orm/mongoid'
5
5
 
6
- Mongoid.connect_to("carrierwave_test")
6
+ connection = Mongo::Connection.new
7
+ Mongoid.database = connection.db("carrierwave_test")
7
8
 
8
9
  describe CarrierWave::Mongoid do
9
10
 
@@ -185,13 +186,13 @@ describe CarrierWave::Mongoid do
185
186
 
186
187
  it "deletes the instance of @class after save" do
187
188
  @doc.save
188
- @class.count(:all, {}).should eql(1)
189
+ @class.count.should eql(1)
189
190
  @doc.destroy
190
191
  end
191
192
 
192
193
  it "deletes the instance of @class after save and then re-looking up the instance" do
193
194
  @doc.save
194
- @class.count(:all, {}).should eql(1)
195
+ @class.count.should eql(1)
195
196
  @doc = @class.first
196
197
  @doc.destroy
197
198
  end
@@ -3,27 +3,27 @@
3
3
  require File.dirname(__FILE__) + '/spec_helper'
4
4
 
5
5
  describe CarrierWave::SanitizedFile do
6
-
6
+
7
7
  before do
8
8
  unless File.exists?(file_path('llama.jpg'))
9
9
  FileUtils.cp(file_path('test.jpg'), file_path('llama.jpg'))
10
10
  end
11
11
  end
12
-
12
+
13
13
  after(:all) do
14
14
  if File.exists?(file_path('llama.jpg'))
15
15
  FileUtils.rm(file_path('llama.jpg'))
16
16
  end
17
17
  FileUtils.rm_rf(public_path)
18
18
  end
19
-
19
+
20
20
  describe '#empty?' do
21
-
21
+
22
22
  it "should be empty for nil" do
23
23
  @sanitized_file = CarrierWave::SanitizedFile.new(nil)
24
24
  @sanitized_file.should be_empty
25
25
  end
26
-
26
+
27
27
  it "should be empty for an empty string" do
28
28
  @sanitized_file = CarrierWave::SanitizedFile.new("")
29
29
  @sanitized_file.should be_empty
@@ -33,106 +33,116 @@ describe CarrierWave::SanitizedFile do
33
33
  @sanitized_file = CarrierWave::SanitizedFile.new(StringIO.new(""))
34
34
  @sanitized_file.should be_empty
35
35
  end
36
-
36
+
37
37
  it "should be empty for a file with a zero size" do
38
38
  empty_file = mock('emptyfile')
39
39
  empty_file.should_receive(:size).at_least(:once).and_return(0)
40
40
  @sanitized_file = CarrierWave::SanitizedFile.new(empty_file)
41
41
  @sanitized_file.should be_empty
42
42
  end
43
-
43
+
44
44
  end
45
-
45
+
46
46
  describe '#original_filename' do
47
47
  it "should default to the original_filename" do
48
48
  file = mock('file', :original_filename => 'llama.jpg')
49
49
  sanitized_file = CarrierWave::SanitizedFile.new(file)
50
50
  sanitized_file.original_filename.should == "llama.jpg"
51
51
  end
52
-
52
+
53
53
  it "should defer to the base name of the path if original_filename is unavailable" do
54
54
  file = mock('file', :path => '/path/to/test.jpg')
55
55
  sanitized_file = CarrierWave::SanitizedFile.new(file)
56
56
  sanitized_file.original_filename.should == "test.jpg"
57
57
  end
58
-
58
+
59
59
  it "should be nil otherwise" do
60
60
  file = mock('file')
61
61
  sanitized_file = CarrierWave::SanitizedFile.new(file)
62
62
  sanitized_file.original_filename.should be_nil
63
63
  end
64
64
  end
65
-
65
+
66
66
  describe '#basename' do
67
67
  it "should return the basename for complicated extensions" do
68
68
  @sanitized_file = CarrierWave::SanitizedFile.new(file_path('complex.filename.tar.gz'))
69
69
  @sanitized_file.basename.should == "complex.filename"
70
70
  end
71
-
71
+
72
72
  it "should be the filename if the file has no extension" do
73
73
  @sanitized_file = CarrierWave::SanitizedFile.new(file_path('complex'))
74
74
  @sanitized_file.basename.should == "complex"
75
75
  end
76
76
  end
77
-
77
+
78
78
  describe '#extension' do
79
79
  it "should return the extension for complicated extensions" do
80
80
  @sanitized_file = CarrierWave::SanitizedFile.new(file_path('complex.filename.tar.gz'))
81
81
  @sanitized_file.extension.should == "tar.gz"
82
82
  end
83
-
83
+
84
+ it "should return the extension for real-world user file names" do
85
+ @sanitized_file = CarrierWave::SanitizedFile.new(file_path('Photo on 2009-12-01 at 11.12.jpg'))
86
+ @sanitized_file.extension.should == "jpg"
87
+ end
88
+
89
+ it "should return the extension for basic filenames" do
90
+ @sanitized_file = CarrierWave::SanitizedFile.new(file_path('something.png'))
91
+ @sanitized_file.extension.should == "png"
92
+ end
93
+
84
94
  it "should be an empty string if the file has no extension" do
85
95
  @sanitized_file = CarrierWave::SanitizedFile.new(file_path('complex'))
86
96
  @sanitized_file.extension.should == ""
87
97
  end
88
98
  end
89
-
99
+
90
100
  describe '#filename' do
91
-
101
+
92
102
  before do
93
103
  @sanitized_file = CarrierWave::SanitizedFile.new(nil)
94
104
  end
95
-
105
+
96
106
  it "should default to the original filename if it is valid" do
97
107
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return("llama.jpg")
98
108
  @sanitized_file.filename.should == "llama.jpg"
99
109
  end
100
-
110
+
101
111
  it "should remove illegal characters from a filename" do
102
112
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return("test-s,%&m#st?.jpg")
103
113
  @sanitized_file.filename.should == "test-s___m_st_.jpg"
104
114
  end
105
-
115
+
106
116
  it "should remove slashes from the filename" do
107
117
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return("../../very_tricky/foo.bar")
108
118
  @sanitized_file.filename.should_not =~ /[\\\/]/
109
119
  end
110
-
120
+
111
121
  it "should remove illegal characters if there is no extension" do
112
122
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return('`*foo')
113
123
  @sanitized_file.filename.should == "__foo"
114
124
  end
115
-
125
+
116
126
  it "should remove the path prefix on Windows" do
117
127
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return('c:\temp\foo.txt')
118
128
  @sanitized_file.filename.should == "foo.txt"
119
129
  end
120
-
130
+
121
131
  it "should make sure the *nix directory thingies can't be used as filenames" do
122
132
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return(".")
123
133
  @sanitized_file.filename.should == "_."
124
134
  end
125
-
135
+
126
136
  it "should downcase uppercase filenames" do
127
137
  @sanitized_file.should_receive(:original_filename).at_least(:once).and_return("DSC4056.JPG")
128
138
  @sanitized_file.filename.should == "dsc4056.jpg"
129
139
  end
130
-
140
+
131
141
  end
132
142
 
133
143
  shared_examples_for "all valid sanitized files" do
134
-
135
- describe '#empty?' do
144
+
145
+ describe '#empty?' do
136
146
  it "should not be empty" do
137
147
  @sanitized_file.should_not be_empty
138
148
  end
@@ -161,7 +171,7 @@ describe CarrierWave::SanitizedFile do
161
171
  @sanitized_file.extension.should == "jpg"
162
172
  end
163
173
  end
164
-
174
+
165
175
  describe "#read" do
166
176
  it "should return the contents of the file" do
167
177
  @sanitized_file.read.should == "this is stuff"
@@ -175,22 +185,22 @@ describe CarrierWave::SanitizedFile do
175
185
  end
176
186
 
177
187
  describe '#move_to' do
178
-
188
+
179
189
  after do
180
190
  FileUtils.rm(file_path('gurr.png'))
181
191
  end
182
-
192
+
183
193
  it "should be moved to the correct location" do
184
194
  @sanitized_file.move_to(file_path('gurr.png'))
185
-
195
+
186
196
  File.exists?( file_path('gurr.png') ).should be_true
187
197
  end
188
-
198
+
189
199
  it "should have changed its path when moved" do
190
200
  @sanitized_file.move_to(file_path('gurr.png'))
191
201
  @sanitized_file.path.should == file_path('gurr.png')
192
202
  end
193
-
203
+
194
204
  it "should have changed its filename when moved" do
195
205
  @sanitized_file.move_to(file_path('gurr.png'))
196
206
  @sanitized_file.filename.should == 'gurr.png'
@@ -200,46 +210,46 @@ describe CarrierWave::SanitizedFile do
200
210
  @sanitized_file.move_to(file_path('gurr.png'))
201
211
  @sanitized_file.basename.should == 'gurr'
202
212
  end
203
-
213
+
204
214
  it "should have changed its extension when moved" do
205
215
  @sanitized_file.move_to(file_path('gurr.png'))
206
216
  @sanitized_file.extension.should == 'png'
207
217
  end
208
-
218
+
209
219
  it "should set the right permissions" do
210
220
  @sanitized_file.move_to(file_path('gurr.png'), 0755)
211
221
  @sanitized_file.should have_permissions(0755)
212
222
  end
213
-
223
+
214
224
  end
215
-
225
+
216
226
  describe '#copy_to' do
217
-
227
+
218
228
  after do
219
229
  FileUtils.rm(file_path('gurr.png'))
220
230
  end
221
-
231
+
222
232
  it "should be copied to the correct location" do
223
233
  @sanitized_file.copy_to(file_path('gurr.png'))
224
234
 
225
235
  File.exists?( file_path('gurr.png') ).should be_true
226
-
236
+
227
237
  file_path('gurr.png').should be_identical_to(file_path('llama.jpg'))
228
238
  end
229
-
239
+
230
240
  it "should not have changed its path when copied" do
231
241
  running { @sanitized_file.copy_to(file_path('gurr.png')) }.should_not change(@sanitized_file, :path)
232
242
  end
233
-
243
+
234
244
  it "should not have changed its filename when copied" do
235
245
  running { @sanitized_file.copy_to(file_path('gurr.png')) }.should_not change(@sanitized_file, :filename)
236
246
  end
237
-
247
+
238
248
  it "should return an object of the same class when copied" do
239
249
  new_file = @sanitized_file.copy_to(file_path('gurr.png'))
240
250
  new_file.should be_an_instance_of(@sanitized_file.class)
241
251
  end
242
-
252
+
243
253
  it "should adjust the path of the object that is returned when copied" do
244
254
  new_file = @sanitized_file.copy_to(file_path('gurr.png'))
245
255
  new_file.path.should == file_path('gurr.png')
@@ -249,17 +259,17 @@ describe CarrierWave::SanitizedFile do
249
259
  new_file = @sanitized_file.copy_to(file_path('gurr.png'))
250
260
  new_file.filename.should == 'gurr.png'
251
261
  end
252
-
262
+
253
263
  it "should adjust the basename of the object that is returned when copied" do
254
264
  new_file = @sanitized_file.copy_to(file_path('gurr.png'))
255
265
  new_file.basename.should == 'gurr'
256
266
  end
257
-
267
+
258
268
  it "should adjust the extension of the object that is returned when copied" do
259
269
  new_file = @sanitized_file.copy_to(file_path('gurr.png'))
260
270
  new_file.extension.should == 'png'
261
271
  end
262
-
272
+
263
273
  it "should set the right permissions" do
264
274
  new_file = @sanitized_file.copy_to(file_path('gurr.png'), 0755)
265
275
  new_file.should have_permissions(0755)
@@ -268,7 +278,7 @@ describe CarrierWave::SanitizedFile do
268
278
  end
269
279
 
270
280
  end
271
-
281
+
272
282
  shared_examples_for "all valid sanitized files that are stored on disk" do
273
283
  describe '#move_to' do
274
284
  it "should not raise an error when moved to its own location" do
@@ -296,13 +306,13 @@ describe CarrierWave::SanitizedFile do
296
306
  File.exist?(new_file.path).should be_true
297
307
  end
298
308
  end
299
-
309
+
300
310
  describe '#exists?' do
301
311
  it "should be true" do
302
312
  @sanitized_file.exists?.should be_true
303
313
  end
304
314
  end
305
-
315
+
306
316
  describe '#delete' do
307
317
  it "should remove it from the filesystem" do
308
318
  File.exists?(@sanitized_file.path).should be_true
@@ -321,24 +331,24 @@ describe CarrierWave::SanitizedFile do
321
331
  }
322
332
  @sanitized_file = CarrierWave::SanitizedFile.new(@hash)
323
333
  end
324
-
334
+
325
335
  it_should_behave_like "all valid sanitized files"
326
336
 
327
337
  it_should_behave_like "all valid sanitized files that are stored on disk"
328
-
338
+
329
339
  describe '#path' do
330
340
  it "should return the path of the tempfile" do
331
341
  @sanitized_file.path.should_not be_nil
332
342
  @sanitized_file.path.should == @hash["tempfile"].path
333
343
  end
334
344
  end
335
-
345
+
336
346
  describe '#is_path?' do
337
347
  it "should be false" do
338
348
  @sanitized_file.is_path?.should be_false
339
349
  end
340
350
  end
341
-
351
+
342
352
  end
343
353
 
344
354
  describe "with a valid Tempfile" do
@@ -356,7 +366,7 @@ describe CarrierWave::SanitizedFile do
356
366
  @sanitized_file.is_path?.should be_false
357
367
  end
358
368
  end
359
-
369
+
360
370
  describe '#path' do
361
371
  it "should return the path of the tempfile" do
362
372
  @sanitized_file.path.should_not be_nil
@@ -370,15 +380,15 @@ describe CarrierWave::SanitizedFile do
370
380
  before do
371
381
  @sanitized_file = CarrierWave::SanitizedFile.new(stub_stringio('llama.jpg', 'image/jpeg'))
372
382
  end
373
-
383
+
374
384
  it_should_behave_like "all valid sanitized files"
375
-
385
+
376
386
  describe '#exists?' do
377
387
  it "should be false" do
378
388
  @sanitized_file.exists?.should be_false
379
389
  end
380
390
  end
381
-
391
+
382
392
  describe '#is_path?' do
383
393
  it "should be false" do
384
394
  @sanitized_file.is_path?.should be_false
@@ -390,13 +400,13 @@ describe CarrierWave::SanitizedFile do
390
400
  @sanitized_file.path.should be_nil
391
401
  end
392
402
  end
393
-
403
+
394
404
  describe '#delete' do
395
405
  it "should not raise an error" do
396
406
  running { @sanitized_file.delete }.should_not raise_error
397
407
  end
398
408
  end
399
-
409
+
400
410
  end
401
411
 
402
412
  describe "with a valid File object" do
@@ -405,9 +415,9 @@ describe CarrierWave::SanitizedFile do
405
415
  @sanitized_file = CarrierWave::SanitizedFile.new(stub_file('llama.jpg', 'image/jpeg'))
406
416
  @sanitized_file.should_not be_empty
407
417
  end
408
-
418
+
409
419
  it_should_behave_like "all valid sanitized files"
410
-
420
+
411
421
  it_should_behave_like "all valid sanitized files that are stored on disk"
412
422
 
413
423
  describe '#is_path?' do
@@ -431,9 +441,9 @@ describe CarrierWave::SanitizedFile do
431
441
  @sanitized_file = CarrierWave::SanitizedFile.new(file_path('llama.jpg'))
432
442
  @sanitized_file.should_not be_empty
433
443
  end
434
-
444
+
435
445
  it_should_behave_like "all valid sanitized files"
436
-
446
+
437
447
  it_should_behave_like "all valid sanitized files that are stored on disk"
438
448
 
439
449
  describe '#is_path?' do
@@ -441,7 +451,7 @@ describe CarrierWave::SanitizedFile do
441
451
  @sanitized_file.is_path?.should be_true
442
452
  end
443
453
  end
444
-
454
+
445
455
  describe '#path' do
446
456
  it "should return the path of the file" do
447
457
  @sanitized_file.path.should_not be_nil
@@ -450,14 +460,14 @@ describe CarrierWave::SanitizedFile do
450
460
  end
451
461
 
452
462
  end
453
-
463
+
454
464
  describe "with a valid Pathname" do
455
465
  before do
456
466
  FileUtils.copy_file(file_path('test.jpg'), file_path('llama.jpg'))
457
467
  @sanitized_file = CarrierWave::SanitizedFile.new(Pathname.new(file_path('llama.jpg')))
458
468
  @sanitized_file.should_not be_empty
459
469
  end
460
-
470
+
461
471
  it_should_behave_like "all valid sanitized files"
462
472
 
463
473
  it_should_behave_like "all valid sanitized files that are stored on disk"
@@ -467,7 +477,7 @@ describe CarrierWave::SanitizedFile do
467
477
  @sanitized_file.is_path?.should be_true
468
478
  end
469
479
  end
470
-
480
+
471
481
  describe '#path' do
472
482
  it "should return the path of the file" do
473
483
  @sanitized_file.path.should_not be_nil
@@ -487,7 +497,7 @@ describe CarrierWave::SanitizedFile do
487
497
  @empty.should be_empty
488
498
  end
489
499
  end
490
-
500
+
491
501
  describe '#exists?' do
492
502
  it "should be false" do
493
503
  @empty.exists?.should be_false
@@ -518,7 +528,7 @@ describe CarrierWave::SanitizedFile do
518
528
  end
519
529
  end
520
530
 
521
- describe '#filename' do
531
+ describe '#filename' do
522
532
  it "should be nil" do
523
533
  @empty.filename.should be_nil
524
534
  end
@@ -535,14 +545,14 @@ describe CarrierWave::SanitizedFile do
535
545
  @empty.extension.should be_nil
536
546
  end
537
547
  end
538
-
548
+
539
549
  describe '#delete' do
540
550
  it "should not raise an error" do
541
551
  running { @empty.delete }.should_not raise_error
542
552
  end
543
553
  end
544
554
  end
545
-
555
+
546
556
  describe "that is an empty string" do
547
557
  before do
548
558
  @empty = CarrierWave::SanitizedFile.new("")
@@ -584,7 +594,7 @@ describe CarrierWave::SanitizedFile do
584
594
  end
585
595
  end
586
596
 
587
- describe '#filename' do
597
+ describe '#filename' do
588
598
  it "should be nil" do
589
599
  @empty.filename.should be_nil
590
600
  end
@@ -608,5 +618,5 @@ describe CarrierWave::SanitizedFile do
608
618
  end
609
619
  end
610
620
  end
611
-
612
- end
621
+
622
+ end
@@ -38,6 +38,14 @@ if ENV['S3_SPEC']
38
38
  it "should have an Amazon URL" do
39
39
  @s3_file.url.should == 'http://s3.amazonaws.com/carrierwave_test/uploads/bar.txt'
40
40
  end
41
+
42
+ context "with cnamed bucket" do
43
+ it "should have a CNAMED URL" do
44
+ @uploader.stub!(:s3_cnamed).and_return(true)
45
+ @uploader.stub!(:s3_bucket).and_return('foo.bar')
46
+ @s3_file.url.should == 'http://foo.bar/uploads/bar.txt'
47
+ end
48
+ end
41
49
 
42
50
  it "should be deletable" do
43
51
  @s3_file.delete
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-26 00:00:00 +01:00
12
+ date: 2009-12-19 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 0.5.8
133
+ version: 0.6.8
134
134
  version:
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: mongoid
@@ -140,7 +140,7 @@ dependencies:
140
140
  requirements:
141
141
  - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 0.5.11
143
+ version: 0.9.9
144
144
  version:
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: aws-s3
@@ -160,7 +160,7 @@ dependencies:
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- version: 2.3.3
163
+ version: 2.4.0
164
164
  version:
165
165
  description: |-
166
166
  * RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/rdoc].