Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
7a38ef79
Commit
7a38ef79
authored
Jan 14, 2011
by
Jon Yurek
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'tilsammans/master'
parents
208883dc
88a65aaf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletions
+49
-1
README.rdoc
+7
-1
lib/paperclip/attachment.rb
+3
-0
test/integration_test.rb
+16
-0
test/storage_test.rb
+23
-0
No files found.
README.rdoc
View file @
7a38ef79
...
...
@@ -15,7 +15,7 @@ useful defaults.
See the documentation for +has_attached_file+ in Paperclip::ClassMethods for
more detailed options.
The complete RDoc[http://rdoc.info/
projects/thoughtbot
/paperclip] is online.
The complete RDoc[http://rdoc.info/
gems
/paperclip] is online.
==Installation
...
...
@@ -23,6 +23,12 @@ Include the gem in your Gemfile:
gem "paperclip", "~> 2.3"
==Installation
As a plugin:
ruby script/plugin install git://github.com/thoughtbot/paperclip.git
==Quick Start
In your model:
...
...
lib/paperclip/attachment.rb
View file @
7a38ef79
...
...
@@ -235,6 +235,9 @@ module Paperclip
else
true
end
rescue
Errno
::
EACCES
=>
e
warn
"
#{
e
}
- skipping file"
false
end
# Returns true if a file has been assigned.
...
...
test/integration_test.rb
View file @
7a38ef79
...
...
@@ -34,6 +34,22 @@ class IntegrationTest < Test::Unit::TestCase
should
"create its thumbnails properly"
do
assert_match
/\b50x50\b/
,
`identify "
#{
@dummy
.
avatar
.
path
(
:thumb
)
}
"`
end
context
'reprocessing with unreadable original'
do
setup
{
File
.
chmod
(
0000
,
@dummy
.
avatar
.
path
)
}
should
"not raise an error"
do
assert_nothing_raised
do
@dummy
.
avatar
.
reprocess!
end
end
should
"return false"
do
assert
!
@dummy
.
avatar
.
reprocess!
end
teardown
{
File
.
chmod
(
0644
,
@dummy
.
avatar
.
path
)
}
end
context
"redefining its attachment styles"
do
setup
do
...
...
test/storage_test.rb
View file @
7a38ef79
...
...
@@ -7,6 +7,29 @@ class StorageTest < Test::Unit::TestCase
Object
.
const_set
(
:Rails
,
stub
(
'Rails'
,
:env
=>
env
))
end
end
context
"filesystem"
do
setup
do
rebuild_model
:styles
=>
{
:thumbnail
=>
"25x25#"
}
@dummy
=
Dummy
.
create!
@dummy
.
avatar
=
File
.
open
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
))
end
should
"allow file assignment"
do
assert
@dummy
.
save
end
should
"store the original"
do
@dummy
.
save
assert
File
.
exists?
(
@dummy
.
avatar
.
path
)
end
should
"store the thumbnail"
do
@dummy
.
save
assert
File
.
exists?
(
@dummy
.
avatar
.
path
(
:thumbnail
))
end
end
context
"Parsing S3 credentials"
do
setup
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment