File tree 5 files changed +44
-3
lines changed
5 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 1
1
* .swp
2
2
tmp
3
+ s3.yml
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ require 'rake/testtask'
3
3
require 'rake/rdoctask'
4
4
require 'rake/gempackagetask'
5
5
6
+ $LOAD_PATH << File . join ( File . dirname ( __FILE__ ) , 'lib' )
7
+ require 'paperclip'
8
+
6
9
desc 'Default: run unit tests.'
7
10
task :default => [ :clean , :test ]
8
11
44
47
45
48
spec = Gem ::Specification . new do |s |
46
49
s . name = "paperclip"
47
- s . version = "2.1.0"
50
+ s . version = Paperclip :: VERSION
48
51
s . author = "Jon Yurek"
49
52
s . email = "jyurek@thoughtbot.com"
50
53
s . homepage = "http://www.thoughtbot.com/"
67
70
Rake ::GemPackageTask . new ( spec ) do |pkg |
68
71
pkg . need_tar = true
69
72
end
73
+
74
+ desc "Release new version"
75
+ task :release => [ :test , :sync_docs , :gem ] do
76
+ require 'rubygems'
77
+ require 'rubyforge'
78
+ r = RubyForge . new
79
+ r . login
80
+ r . add_release spec . rubyforge_project ,
81
+ spec . name ,
82
+ spec . version ,
83
+ File . join ( "pkg" , "#{ spec . name } -#{ spec . version } .gem" )
84
+ end
Original file line number Diff line number Diff line change 1
1
require File . join ( File . dirname ( __FILE__ ) , "lib" , "paperclip" )
2
- ActiveRecord ::Base . extend ( Paperclip ::ClassMethods )
3
- File . send :include , Paperclip ::Upfile
Original file line number Diff line number Diff line change 35
35
36
36
# The base module that gets included in ActiveRecord::Base.
37
37
module Paperclip
38
+
39
+ VERSION = "2.1.0"
40
+
38
41
class << self
39
42
# Provides configurability to Paperclip. There are a number of options available, such as:
40
43
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
@@ -198,3 +201,9 @@ def destroy_attached_files
198
201
end
199
202
200
203
end
204
+
205
+ # Set it all up.
206
+ if Object . const_defined? ( "ActiveRecord" )
207
+ ActiveRecord ::Base . send ( :include , Paperclip )
208
+ File . send ( :include , Paperclip ::Upfile )
209
+ end
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ class AttachmentTest < Test::Unit::TestCase
81
81
Paperclip ::Attachment . default_options . merge! ( {
82
82
:path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
83
83
} )
84
+ FileUtils . rm_rf ( "tmp" )
84
85
@instance = stub
85
86
@instance . stubs ( :id ) . returns ( 41 )
86
87
@instance . stubs ( :class ) . returns ( Dummy )
@@ -172,6 +173,23 @@ class AttachmentTest < Test::Unit::TestCase
172
173
should "still have its #file attribute not be nil" do
173
174
assert ! @attachment . file . nil?
174
175
end
176
+
177
+ context "and deleted" do
178
+ setup do
179
+ @existing_names = @attachment . styles . keys . collect do |style |
180
+ @attachment . path ( style )
181
+ end
182
+ @instance . expects ( :[]= ) . with ( :test_file_name , nil )
183
+ @instance . expects ( :[]= ) . with ( :test_content_type , nil )
184
+ @instance . expects ( :[]= ) . with ( :test_file_size , nil )
185
+ @attachment . assign nil
186
+ @attachment . save
187
+ end
188
+
189
+ should "delete the files" do
190
+ @existing_names . each { |f | assert ! File . exists? ( f ) }
191
+ end
192
+ end
175
193
end
176
194
end
177
195
end
You can’t perform that action at this time.
0 commit comments