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
822de421
Commit
822de421
authored
Jun 28, 2011
by
Alex Godin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:thoughtbot/paperclip
parents
a51811de
8d262e30
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
lib/paperclip/interpolations.rb
+5
-0
test/integration_test.rb
+12
-0
test/interpolations_test.rb
+7
-0
No files found.
lib/paperclip/interpolations.rb
View file @
822de421
...
...
@@ -99,6 +99,11 @@ module Paperclip
attachment
.
instance
.
id
end
# Returns the #to_param of the instance.
def
param
attachment
,
style_name
attachment
.
instance
.
to_param
end
# Returns the fingerprint of the instance.
def
fingerprint
attachment
,
style_name
attachment
.
fingerprint
...
...
test/integration_test.rb
View file @
822de421
...
...
@@ -467,6 +467,18 @@ class IntegrationTest < Test::Unit::TestCase
@files_on_s3
=
s3_files_for
@dummy
.
avatar
end
context
'assigning itself to a new model'
do
setup
do
@d2
=
Dummy
.
new
@d2
.
avatar
=
@dummy
.
avatar
@d2
.
save
end
should
"have the same name as the old file"
do
assert_equal
@d2
.
avatar
.
original_filename
,
@dummy
.
avatar
.
original_filename
end
end
should
"have the same contents as the original"
do
@file
.
rewind
assert_equal
@file
.
read
,
@files_on_s3
[
:original
].
read
...
...
test/interpolations_test.rb
View file @
822de421
...
...
@@ -50,6 +50,13 @@ class InterpolationsTest < Test::Unit::TestCase
assert_equal
"png"
,
Paperclip
::
Interpolations
.
extension
(
attachment
,
:style
)
end
should
"return the #to_param of the attachment"
do
attachment
=
mock
attachment
.
expects
(
:to_param
).
returns
(
"23-awesome"
)
attachment
.
expects
(
:instance
).
returns
(
attachment
)
assert_equal
"23-awesome"
,
Paperclip
::
Interpolations
.
param
(
attachment
,
:style
)
end
should
"return the id of the attachment"
do
attachment
=
mock
attachment
.
expects
(
:id
).
returns
(
23
)
...
...
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