paperclip 3.0.2 → 3.0.3

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

Potentially problematic release.


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

Files changed (47) hide show
  1. data/CONTRIBUTING.md +34 -2
  2. data/NEWS +33 -1
  3. data/README.md +20 -6
  4. data/RUNNING_TESTS.md +4 -0
  5. data/features/basic_integration.feature +4 -2
  6. data/features/support/fakeweb.rb +7 -0
  7. data/lib/paperclip.rb +2 -1
  8. data/lib/paperclip/attachment.rb +28 -16
  9. data/lib/paperclip/glue.rb +8 -0
  10. data/lib/paperclip/helpers.rb +4 -16
  11. data/lib/paperclip/instance_methods.rb +1 -1
  12. data/lib/paperclip/io_adapters/attachment_adapter.rb +13 -4
  13. data/lib/paperclip/io_adapters/file_adapter.rb +5 -3
  14. data/lib/paperclip/io_adapters/stringio_adapter.rb +4 -2
  15. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +3 -1
  16. data/lib/paperclip/missing_attachment_styles.rb +5 -8
  17. data/lib/paperclip/railtie.rb +4 -7
  18. data/lib/paperclip/storage/fog.rb +11 -0
  19. data/lib/paperclip/storage/s3.rb +26 -0
  20. data/lib/paperclip/tempfile.rb +7 -5
  21. data/lib/paperclip/validators.rb +1 -0
  22. data/lib/paperclip/validators/attachment_content_type_validator.rb +8 -1
  23. data/lib/paperclip/version.rb +1 -1
  24. data/lib/tasks/paperclip.rake +1 -1
  25. data/paperclip.gemspec +3 -3
  26. data/test/attachment_test.rb +77 -23
  27. data/test/geometry_test.rb +3 -3
  28. data/test/helper.rb +10 -10
  29. data/test/integration_test.rb +103 -56
  30. data/test/{attachment_adapter_test.rb → io_adapters/attachment_adapter_test.rb} +4 -1
  31. data/test/io_adapters/file_adapter_test.rb +88 -0
  32. data/test/{identity_adapter_test.rb → io_adapters/identity_adapter_test.rb} +0 -0
  33. data/test/{nil_adapter_test.rb → io_adapters/nil_adapter_test.rb} +0 -0
  34. data/test/{adapter_registry_test.rb → io_adapters/registry_test.rb} +0 -0
  35. data/test/{stringio_adapter_test.rb → io_adapters/stringio_adapter_test.rb} +0 -0
  36. data/test/{uploaded_file_adapter_test.rb → io_adapters/uploaded_file_adapter_test.rb} +0 -0
  37. data/test/paperclip_missing_attachment_styles_test.rb +10 -12
  38. data/test/paperclip_test.rb +4 -2
  39. data/test/storage/filesystem_test.rb +24 -16
  40. data/test/storage/fog_test.rb +14 -5
  41. data/test/storage/s3_live_test.rb +40 -12
  42. data/test/storage/s3_test.rb +13 -9
  43. data/test/style_test.rb +1 -1
  44. data/test/thumbnail_test.rb +7 -3
  45. data/test/validators/attachment_content_type_validator_test.rb +53 -1
  46. metadata +30 -28
  47. data/test/file_adapter_test.rb +0 -43
@@ -5,34 +5,34 @@ class PaperclipMissingAttachmentStylesTest < Test::Unit::TestCase
5
5
  context "Paperclip" do
6
6
  setup do
7
7
  Paperclip.classes_with_attachments = Set.new
8
- end
9
-
8
+ end
9
+
10
10
  teardown do
11
11
  File.unlink(Paperclip.registered_attachments_styles_path) rescue nil
12
12
  end
13
13
 
14
14
  should "be able to keep list of models using it" do
15
- assert_kind_of Set, Paperclip.classes_with_attachments
15
+ assert_kind_of Set, Paperclip.classes_with_attachments
16
16
  assert Paperclip.classes_with_attachments.empty?, 'list should be empty'
17
17
  rebuild_model
18
18
  assert_equal ['Dummy'].to_set, Paperclip.classes_with_attachments
19
19
  end
20
20
 
21
21
  should "enable to get and set path to registered styles file" do
22
- assert_equal ROOT.join('public/system/paperclip_attachments.yml').to_s, Paperclip.registered_attachments_styles_path
22
+ assert_equal ROOT.join('tmp/public/system/paperclip_attachments.yml').to_s, Paperclip.registered_attachments_styles_path
23
23
  Paperclip.registered_attachments_styles_path = '/tmp/config/paperclip_attachments.yml'
24
24
  assert_equal '/tmp/config/paperclip_attachments.yml', Paperclip.registered_attachments_styles_path
25
25
  Paperclip.registered_attachments_styles_path = nil
26
- assert_equal ROOT.join('public/system/paperclip_attachments.yml').to_s, Paperclip.registered_attachments_styles_path
26
+ assert_equal ROOT.join('tmp/public/system/paperclip_attachments.yml').to_s, Paperclip.registered_attachments_styles_path
27
27
  end
28
-
28
+
29
29
  should "be able to get current attachment styles" do
30
30
  assert_equal Hash.new, Paperclip.send(:current_attachments_styles)
31
31
  rebuild_model :styles => {:croppable => '600x600>', :big => '1000x1000>'}
32
32
  expected_hash = { :Dummy => {:avatar => [:big, :croppable]}}
33
33
  assert_equal expected_hash, Paperclip.send(:current_attachments_styles)
34
34
  end
35
-
35
+
36
36
  should "be able to save current attachment styles for further comparison" do
37
37
  rebuild_model :styles => {:croppable => '600x600>', :big => '1000x1000>'}
38
38
  Paperclip.save_current_attachments_styles!
@@ -68,15 +68,15 @@ class PaperclipMissingAttachmentStylesTest < Test::Unit::TestCase
68
68
  Paperclip.save_current_attachments_styles!
69
69
  assert_equal Hash.new, Paperclip.missing_attachments_styles
70
70
  end
71
-
71
+
72
72
  should "be able to calculate differences when a new attachment is added to a model" do
73
73
  rebuild_model :styles => {:croppable => '600x600>', :big => '1000x1000>'}
74
74
  Paperclip.save_current_attachments_styles!
75
-
75
+
76
76
  class ::Dummy
77
77
  has_attached_file :photo, :styles => {:small => 'x100', :large => '1000x1000>'}
78
78
  end
79
-
79
+
80
80
  expected_hash = {
81
81
  :Dummy => {:photo => [:large, :small]}
82
82
  }
@@ -90,7 +90,5 @@ class PaperclipMissingAttachmentStylesTest < Test::Unit::TestCase
90
90
  rebuild_model :styles => lambda{ |attachment| attachment.instance.other == 'a' ? {:thumb => "50x50#"} : {:large => "400x400"} }
91
91
  assert_equal Hash.new, Paperclip.send(:current_attachments_styles)
92
92
  end
93
-
94
93
  end
95
-
96
94
  end
@@ -60,13 +60,15 @@ class PaperclipTest < Test::Unit::TestCase
60
60
 
61
61
  context "Paperclip.each_instance_with_attachment" do
62
62
  setup do
63
- @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb')
63
+ @file = File.new(fixture_file("5k.png"), 'rb')
64
64
  d1 = Dummy.create(:avatar => @file)
65
65
  d2 = Dummy.create
66
66
  d3 = Dummy.create(:avatar => @file)
67
67
  @expected = [d1, d3]
68
68
  end
69
69
 
70
+ teardown { @file.close }
71
+
70
72
  should "yield every instance of a model that has an attachment" do
71
73
  actual = []
72
74
  Paperclip.each_instance_with_attachment("Dummy", "avatar") do |instance|
@@ -129,7 +131,7 @@ class PaperclipTest < Test::Unit::TestCase
129
131
  context "An ActiveRecord model with an 'avatar' attachment" do
130
132
  setup do
131
133
  rebuild_model :path => "tmp/:class/omg/:style.:extension"
132
- @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb')
134
+ @file = File.new(fixture_file("5k.png"), 'rb')
133
135
  end
134
136
 
135
137
  teardown { @file.close }
@@ -2,25 +2,30 @@ require './test/helper'
2
2
 
3
3
  class FileSystemTest < Test::Unit::TestCase
4
4
  context "Filesystem" do
5
- setup do
6
- rebuild_model :styles => { :thumbnail => "25x25#" }
7
- @dummy = Dummy.create!
5
+ context "normal file" do
6
+ setup do
7
+ rebuild_model :styles => { :thumbnail => "25x25#" }
8
+ @dummy = Dummy.create!
8
9
 
9
- @dummy.avatar = File.open(fixture_file('5k.png'))
10
- end
10
+ @file = File.open(fixture_file('5k.png'))
11
+ @dummy.avatar = @file
12
+ end
11
13
 
12
- should "allow file assignment" do
13
- assert @dummy.save
14
- end
14
+ teardown { @file.close }
15
15
 
16
- should "store the original" do
17
- @dummy.save
18
- assert File.exists?(@dummy.avatar.path)
19
- end
16
+ should "allow file assignment" do
17
+ assert @dummy.save
18
+ end
20
19
 
21
- should "store the thumbnail" do
22
- @dummy.save
23
- assert File.exists?(@dummy.avatar.path(:thumbnail))
20
+ should "store the original" do
21
+ @dummy.save
22
+ assert File.exists?(@dummy.avatar.path)
23
+ end
24
+
25
+ should "store the thumbnail" do
26
+ @dummy.save
27
+ assert File.exists?(@dummy.avatar.path(:thumbnail))
28
+ end
24
29
  end
25
30
 
26
31
  context "with file that has space in file name" do
@@ -28,10 +33,13 @@ class FileSystemTest < Test::Unit::TestCase
28
33
  rebuild_model :styles => { :thumbnail => "25x25#" }
29
34
  @dummy = Dummy.create!
30
35
 
31
- @dummy.avatar = File.open(fixture_file('spaced file.png'))
36
+ @file = File.open(fixture_file('spaced file.png'))
37
+ @dummy.avatar = @file
32
38
  @dummy.save
33
39
  end
34
40
 
41
+ teardown { @file.close }
42
+
35
43
  should "store the file" do
36
44
  assert File.exists?(@dummy.avatar.path)
37
45
  end
@@ -5,7 +5,6 @@ Fog.mock!
5
5
 
6
6
  class FogTest < Test::Unit::TestCase
7
7
  context "" do
8
-
9
8
  context "with credentials provided in a path string" do
10
9
  setup do
11
10
  rebuild_model :styles => { :medium => "300x300>", :thumb => "100x100>" },
@@ -13,10 +12,13 @@ class FogTest < Test::Unit::TestCase
13
12
  :url => '/:attachment/:filename',
14
13
  :fog_directory => "paperclip",
15
14
  :fog_credentials => fixture_file('fog.yml')
15
+ @file = File.new(fixture_file('5k.png'), 'rb')
16
16
  @dummy = Dummy.new
17
- @dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
17
+ @dummy.avatar = @file
18
18
  end
19
19
 
20
+ teardown { @file.close }
21
+
20
22
  should "have the proper information loading credentials from a file" do
21
23
  assert_equal @dummy.avatar.fog_credentials[:provider], 'AWS'
22
24
  end
@@ -29,10 +31,13 @@ class FogTest < Test::Unit::TestCase
29
31
  :url => '/:attachment/:filename',
30
32
  :fog_directory => "paperclip",
31
33
  :fog_credentials => File.open(fixture_file('fog.yml'))
34
+ @file = File.new(fixture_file('5k.png'), 'rb')
32
35
  @dummy = Dummy.new
33
- @dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
36
+ @dummy.avatar = @file
34
37
  end
35
38
 
39
+ teardown { @file.close }
40
+
36
41
  should "have the proper information loading credentials from a file" do
37
42
  assert_equal @dummy.avatar.fog_credentials[:provider], 'AWS'
38
43
  end
@@ -49,11 +54,15 @@ class FogTest < Test::Unit::TestCase
49
54
  :aws_access_key_id => 'AWS_ID',
50
55
  :aws_secret_access_key => 'AWS_SECRET'
51
56
  }
57
+ @file = File.new(fixture_file('5k.png'), 'rb')
52
58
  @dummy = Dummy.new
53
- @dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
59
+ @dummy.avatar = @file
54
60
  end
61
+
62
+ teardown { @file.close }
63
+
55
64
  should "be able to interpolate the path without blowing up" do
56
- assert_equal File.expand_path(File.join(File.dirname(__FILE__), "../../public/avatars/5k.png")),
65
+ assert_equal File.expand_path(File.join(File.dirname(__FILE__), "../../tmp/public/avatars/5k.png")),
57
66
  @dummy.avatar.path
58
67
  end
59
68
  end
@@ -1,21 +1,22 @@
1
1
  require './test/helper'
2
2
  require 'aws'
3
3
 
4
-
5
4
  unless ENV["S3_BUCKET"].blank?
6
5
  class S3LiveTest < Test::Unit::TestCase
7
-
8
6
  context "when assigning an S3 attachment directly to another model" do
9
7
  setup do
8
+ @s3_credentials = File.new(fixture_file("s3.yml"))
10
9
  rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
11
10
  :storage => :s3,
12
11
  :bucket => ENV["S3_BUCKET"],
13
12
  :path => ":class/:attachment/:id/:style.:extension",
14
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))
13
+ :s3_credentials => @s3_credentials
15
14
 
16
- @dummy = Dummy.new
17
- @attachment = Dummy.new.avatar
18
15
  @file = File.new(fixture_file("5k.png"))
16
+ end
17
+
18
+ should "not raise any error" do
19
+ @attachment = Dummy.new.avatar
19
20
  @attachment.assign(@file)
20
21
  @attachment.save
21
22
 
@@ -23,19 +24,32 @@ unless ENV["S3_BUCKET"].blank?
23
24
  @attachment2.assign(@file)
24
25
  @attachment2.save
25
26
  end
26
- end
27
27
 
28
+ should "allow assignment from another S3 object" do
29
+ @attachment = Dummy.new.avatar
30
+ @attachment.assign(@file)
31
+ @attachment.save
32
+
33
+ @attachment2 = Dummy.new.avatar
34
+ @attachment2.assign(@attachment)
35
+ @attachment2.save
36
+ end
37
+
38
+ teardown { [@s3_credentials, @file].each(&:close) }
39
+ end
28
40
 
29
41
  context "Generating an expiring url on a nonexistant attachment" do
30
42
  setup do
43
+ @s3_credentials = File.new(fixture_file("s3.yml"))
31
44
  rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
32
45
  :storage => :s3,
33
46
  :bucket => ENV["S3_BUCKET"],
34
47
  :path => ":class/:attachment/:id/:style.:extension",
35
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))
48
+ :s3_credentials => @s3_credentials
36
49
 
37
50
  @dummy = Dummy.new
38
51
  end
52
+
39
53
  should "return nil" do
40
54
  assert_nil @dummy.avatar.expiring_url
41
55
  end
@@ -43,16 +57,19 @@ unless ENV["S3_BUCKET"].blank?
43
57
 
44
58
  context "Using S3 for real, an attachment with S3 storage" do
45
59
  setup do
60
+ @s3_credentials = File.new(fixture_file("s3.yml"))
46
61
  rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
47
62
  :storage => :s3,
48
63
  :bucket => ENV["S3_BUCKET"],
49
64
  :path => ":class/:attachment/:id/:style.:extension",
50
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))
65
+ :s3_credentials => @s3_credentials
51
66
 
52
67
  Dummy.delete_all
53
68
  @dummy = Dummy.new
54
69
  end
55
70
 
71
+ teardown { @s3_credentials.close }
72
+
56
73
  should "be extended by the S3 module" do
57
74
  assert Dummy.new.avatar.is_a?(Paperclip::Storage::S3)
58
75
  end
@@ -82,17 +99,21 @@ unless ENV["S3_BUCKET"].blank?
82
99
 
83
100
  context "An attachment that uses S3 for storage and has spaces in file name" do
84
101
  setup do
102
+ @s3_credentials = File.new(fixture_file("s3.yml"))
85
103
  rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
86
104
  :storage => :s3,
87
105
  :bucket => ENV["S3_BUCKET"],
88
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))
106
+ :s3_credentials => @s3_credentials
89
107
 
90
108
  Dummy.delete_all
109
+ @file = File.new(fixture_file('spaced file.png'), 'rb')
91
110
  @dummy = Dummy.new
92
- @dummy.avatar = File.new(fixture_file('spaced file.png'), 'rb')
111
+ @dummy.avatar = @file
93
112
  @dummy.save
94
113
  end
95
114
 
115
+ teardown { @s3_credentials.close }
116
+
96
117
  should "return a replaced version for path" do
97
118
  assert_match /.+\/spaced_file\.png/, @dummy.avatar.path
98
119
  end
@@ -105,7 +126,11 @@ unless ENV["S3_BUCKET"].blank?
105
126
  assert_success_response @dummy.avatar.url
106
127
  end
107
128
 
108
- should "be destoryable" do
129
+ should "be reprocessable" do
130
+ assert @dummy.avatar.reprocess!
131
+ end
132
+
133
+ should "be destroyable" do
109
134
  url = @dummy.avatar.url
110
135
  @dummy.destroy
111
136
  assert_not_found_response url
@@ -114,17 +139,20 @@ unless ENV["S3_BUCKET"].blank?
114
139
 
115
140
  context "An attachment that uses S3 for storage and uses AES256 encryption" do
116
141
  setup do
142
+ @s3_credentials = File.new(fixture_file("s3.yml"))
117
143
  rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
118
144
  :storage => :s3,
119
145
  :bucket => ENV["S3_BUCKET"],
120
146
  :path => ":class/:attachment/:id/:style.:extension",
121
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml")),
147
+ :s3_credentials => @s3_credentials,
122
148
  :s3_server_side_encryption => :aes256
123
149
 
124
150
  Dummy.delete_all
125
151
  @dummy = Dummy.new
126
152
  end
127
153
 
154
+ teardown { @s3_credentials.close }
155
+
128
156
  context "when assigned" do
129
157
  setup do
130
158
  @file = File.new(fixture_file('5k.png'), 'rb')
@@ -186,8 +186,10 @@ class S3Test < Test::Unit::TestCase
186
186
  'secret_access_key' => "54321"
187
187
  }
188
188
 
189
- @dummy = Dummy.new
190
- @dummy.avatar = File.new(fixture_file('5k.png'), 'rb')
189
+ File.open(fixture_file('5k.png'), 'rb') do |file|
190
+ @dummy = Dummy.new
191
+ @dummy.avatar = file
192
+ end
191
193
  end
192
194
 
193
195
  should "return a url containing the correct original file mime type" do
@@ -217,8 +219,10 @@ class S3Test < Test::Unit::TestCase
217
219
  'secret_access_key' => "54321"
218
220
  }
219
221
 
220
- @dummy = Dummy.new
221
- @dummy.avatar = File.new(fixture_file('spaced file.png'), 'rb')
222
+ File.open(fixture_file('spaced file.png'), 'rb') do |file|
223
+ @dummy = Dummy.new
224
+ @dummy.avatar = file
225
+ end
222
226
  end
223
227
 
224
228
  should "return a replaced version for path" do
@@ -666,7 +670,7 @@ class S3Test < Test::Unit::TestCase
666
670
 
667
671
  context "when assigned" do
668
672
  setup do
669
- @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
673
+ @file = File.new(fixture_file('5k.png'), 'rb')
670
674
  @dummy = Dummy.new
671
675
  @dummy.avatar = @file
672
676
  end
@@ -705,7 +709,7 @@ class S3Test < Test::Unit::TestCase
705
709
 
706
710
  context "when assigned" do
707
711
  setup do
708
- @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
712
+ @file = File.new(fixture_file('5k.png'), 'rb')
709
713
  @dummy = Dummy.new
710
714
  @dummy.avatar = @file
711
715
  end
@@ -744,7 +748,7 @@ class S3Test < Test::Unit::TestCase
744
748
 
745
749
  context "when assigned" do
746
750
  setup do
747
- @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
751
+ @file = File.new(fixture_file('5k.png'), 'rb')
748
752
  @dummy = Dummy.new
749
753
  @dummy.avatar = @file
750
754
  end
@@ -783,7 +787,7 @@ class S3Test < Test::Unit::TestCase
783
787
 
784
788
  context "when assigned" do
785
789
  setup do
786
- @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
790
+ @file = File.new(fixture_file('5k.png'), 'rb')
787
791
  @dummy = Dummy.new
788
792
  @dummy.avatar = @file
789
793
  end
@@ -822,7 +826,7 @@ class S3Test < Test::Unit::TestCase
822
826
 
823
827
  context "when assigned" do
824
828
  setup do
825
- @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb')
829
+ @file = File.new(fixture_file('5k.png'), 'rb')
826
830
  @dummy = Dummy.new
827
831
  @dummy.avatar = @file
828
832
  end
@@ -60,7 +60,7 @@ class StyleTest < Test::Unit::TestCase
60
60
 
61
61
  context "An attachment with style rules in various forms" do
62
62
  setup do
63
- styles = ActiveSupport::OrderedHash.new
63
+ styles = {}
64
64
  styles[:aslist] = ["100x100", :png]
65
65
  styles[:ashash] = {:geometry => "100x100", :format => :png}
66
66
  styles[:asstring] = "100x100"
@@ -7,6 +7,8 @@ class ThumbnailTest < Test::Unit::TestCase
7
7
  @tempfile = Paperclip::Tempfile.new(["file", ".jpg"])
8
8
  end
9
9
 
10
+ teardown { @tempfile.close }
11
+
10
12
  should "have its path contain a real extension" do
11
13
  assert_equal ".jpg", File.extname(@tempfile.path)
12
14
  end
@@ -21,6 +23,8 @@ class ThumbnailTest < Test::Unit::TestCase
21
23
  @tempfile = Paperclip::Tempfile.new("file")
22
24
  end
23
25
 
26
+ teardown { @tempfile.close }
27
+
24
28
  should "not have an extension if not given one" do
25
29
  assert_equal "", File.extname(@tempfile.path)
26
30
  end
@@ -32,7 +36,7 @@ class ThumbnailTest < Test::Unit::TestCase
32
36
 
33
37
  context "An image" do
34
38
  setup do
35
- @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb')
39
+ @file = File.new(fixture_file("5k.png"), 'rb')
36
40
  end
37
41
 
38
42
  teardown { @file.close }
@@ -292,7 +296,7 @@ class ThumbnailTest < Test::Unit::TestCase
292
296
 
293
297
  context "A multipage PDF" do
294
298
  setup do
295
- @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "twopage.pdf"), 'rb')
299
+ @file = File.new(fixture_file("twopage.pdf"), 'rb')
296
300
  end
297
301
 
298
302
  teardown { @file.close }
@@ -325,7 +329,7 @@ class ThumbnailTest < Test::Unit::TestCase
325
329
 
326
330
  context "An animated gif" do
327
331
  setup do
328
- @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "animated.gif"), 'rb')
332
+ @file = File.new(fixture_file("animated.gif"), 'rb')
329
333
  end
330
334
 
331
335
  teardown { @file.close }