paperclip-storage-tmp 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.ci +5 -0
- data/README.md +7 -8
- data/Rakefile +5 -0
- data/lib/paperclip-storage-tmp/version.rb +1 -1
- data/paperclip-storage-tmp.gemspec +2 -1
- data/spec/lib/paperclip/storage/tmp_spec.rb +2 -3
- metadata +28 -4
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile.ci
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# paperclip-storage-tmp
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/exviva/paperclip-storage-tmp.png?branch=master)](http://travis-ci.org/exviva/paperclip-storage-tmp)
|
4
|
+
|
3
5
|
This gem allows you to configure Paperclip 2.x to use your temporary directory to store the attachments. The attachments are deleted as soon as your Ruby process exits, or whenever you ask the gem to delete them (e.g. after every test), ensuring isolated state for each test.
|
4
6
|
|
5
7
|
Thanks to this gem your `public/system` directory is no longer cluttered with attachments dangling in there after your test suite has finished running.
|
@@ -28,7 +30,7 @@ Just like you wouldn't want to use the same database in development and test, yo
|
|
28
30
|
|
29
31
|
## Compatibility with Paperclip versions
|
30
32
|
|
31
|
-
Please note that this gem has been written with Paperclip 2.x in mind (extracted from and battle-tested in an application dependent on Paperclip 2.4.0). The gemspec declares a rather loose dependency on Paperclip of '~> 2.
|
33
|
+
Please note that this gem has been written with Paperclip 2.x in mind (extracted from and battle-tested in an application dependent on Paperclip 2.4.0, then upgraded to 2.7.0). The gemspec declares a rather loose dependency on Paperclip of '~> 2.4', '>= 2.4.2', so make sure the gem is behaving as expected. Since it's supposed to be used only in test environment, it shouldn't be harmful to just give it a try. If you confirm that it's working for the version of Paperclip you're using, let me know.
|
32
34
|
|
33
35
|
Any pull requests increasing compatibility with other versions welcome!
|
34
36
|
|
@@ -92,11 +94,9 @@ Or, just use the provided one-line testing helpers for RSpec and Cucumber, which
|
|
92
94
|
|
93
95
|
## Caveats
|
94
96
|
|
95
|
-
Beware that the file
|
96
|
-
|
97
|
-
Also, Paperclip doesn't know that the file doesn't physically exist in `public/system`, so you can't use `Attachment#path` to access the physical file. You can use `attachment.to_file.path` to find the actual location of the attachment on disk.
|
97
|
+
Beware that Paperclip doesn't know that the file doesn't physically exist in `public/system`, so you can't use `Attachment#path` to access the physical file. You can use `attachment.to_file.path` to find the actual location of the attachment on disk.
|
98
98
|
|
99
|
-
Here are a couple of specs, which expose the expected behaviour of this gem. The
|
99
|
+
Here are a couple of specs, which expose the expected behaviour of this gem. The spec markes with `# FAIL` exposes the caveat:
|
100
100
|
|
101
101
|
describe User do
|
102
102
|
describe 'avatar' do
|
@@ -141,10 +141,9 @@ Here are a couple of specs, which expose the expected behaviour of this gem. The
|
|
141
141
|
new_user.reload.avatar_file_name.should eq('hey_mom_its_me.png')
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
|
-
it 'cannot handle assignment from Paperclip::Attachment' do
|
144
|
+
it 'can handle assignment from Paperclip::Attachment' do
|
146
145
|
new_user = User.new(avatar: subject)
|
147
|
-
new_user.avatar_file_name.
|
146
|
+
new_user.avatar_file_name.should eq('hey_mom_its_me.png')
|
148
147
|
end
|
149
148
|
end
|
150
149
|
end
|
data/Rakefile
CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ['lib']
|
15
15
|
gem.version = Paperclip::Storage::Tmp::VERSION
|
16
16
|
|
17
|
-
gem.add_runtime_dependency 'paperclip', '~> 2.
|
17
|
+
gem.add_runtime_dependency 'paperclip', '>= 2.4.2', '~> 2.4'
|
18
|
+
gem.add_development_dependency 'rake'
|
18
19
|
gem.add_development_dependency 'rspec'
|
19
20
|
gem.add_development_dependency 'sqlite3'
|
20
21
|
end
|
@@ -48,10 +48,9 @@ describe Paperclip::Storage::Tmp do
|
|
48
48
|
new_user.reload.avatar_file_name.should eq('hey_mom_its_me.png')
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
it 'cannot handle assignment from Paperclip::Attachment' do
|
51
|
+
it 'can handle assignment from Paperclip::Attachment' do
|
53
52
|
new_user = User.new(avatar: subject)
|
54
|
-
new_user.avatar_file_name.
|
53
|
+
new_user.avatar_file_name.should eq('hey_mom_its_me.png')
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-storage-tmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,46 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: paperclip
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.4.2
|
19
22
|
- - ~>
|
20
23
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2.
|
24
|
+
version: '2.4'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
25
28
|
none: false
|
26
29
|
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.4.2
|
27
33
|
- - ~>
|
28
34
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
35
|
+
version: '2.4'
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
30
52
|
- !ruby/object:Gem::Dependency
|
31
53
|
name: rspec
|
32
54
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,8 +90,10 @@ extra_rdoc_files: []
|
|
68
90
|
files:
|
69
91
|
- .gitignore
|
70
92
|
- .rspec
|
93
|
+
- .travis.yml
|
71
94
|
- CHANGELOG.md
|
72
95
|
- Gemfile
|
96
|
+
- Gemfile.ci
|
73
97
|
- LICENSE
|
74
98
|
- README.md
|
75
99
|
- Rakefile
|