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
8dd016dd
Commit
8dd016dd
authored
Apr 29, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed double/no slashes on new s3 url builder.
Put merged tests in the right place.
parent
269ba250
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
lib/paperclip/storage.rb
+1
-1
test/test_attachment.rb
+9
-9
test/test_integration.rb
+1
-0
test/test_storage.rb
+1
-1
No files found.
lib/paperclip/storage.rb
View file @
8dd016dd
...
...
@@ -53,7 +53,7 @@ module Paperclip
@url
=
":s3_url"
end
base
.
class
.
interpolations
[
:s3_url
]
=
lambda
do
|
attachment
,
style
|
"https://s3.amazonaws.com/
#{
attachment
.
bucket_name
}
#{
attachment
.
path
(
style
)
}
"
"https://s3.amazonaws.com/
#{
attachment
.
bucket_name
}
/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
end
end
...
...
test/test_attachment.rb
View file @
8dd016dd
...
...
@@ -111,15 +111,6 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
"/tests/blah/missing.png"
,
@attachment
.
url
(
:blah
)
end
should
"return the proper path when filename has a single .'s"
do
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.png"
,
@attachment
.
path
end
should
"return the proper path when filename has multiple .'s"
do
@instance
.
stubs
(
:[]
).
with
(
:test_file_name
).
returns
(
"5k.old.png"
)
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.old.png"
,
@attachment
.
path
end
context
"with a file assigned in the database"
do
setup
do
@instance
.
stubs
(
:[]
).
with
(
:test_file_name
).
returns
(
"5k.png"
)
...
...
@@ -132,6 +123,15 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
"/tests/41/blah/5k.png"
,
@attachment
.
url
(
:blah
)
end
should
"return the proper path when filename has a single .'s"
do
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.png"
,
@attachment
.
path
end
should
"return the proper path when filename has multiple .'s"
do
@instance
.
stubs
(
:[]
).
with
(
:test_file_name
).
returns
(
"5k.old.png"
)
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.old.png"
,
@attachment
.
path
end
context
"when expecting three styles"
do
setup
do
styles
=
{
:styles
=>
{
:large
=>
[
"400x400"
,
:png
],
...
...
test/test_integration.rb
View file @
8dd016dd
...
...
@@ -127,6 +127,7 @@ class IntegrationTest < Test::Unit::TestCase
if
ENV
[
'S3_TEST_BUCKET'
]
def
s3_files_for
attachment
[
:thumb
,
:medium
,
:large
,
:original
].
inject
({})
do
|
files
,
style
|
p
attachment
.
url
(
style
)
data
=
`curl '
#{
attachment
.
url
(
style
)
}
' 2>/dev/null`
.
chomp
t
=
Tempfile
.
new
(
"paperclip-test"
)
t
.
write
(
data
)
...
...
test/test_storage.rb
View file @
8dd016dd
...
...
@@ -46,7 +46,7 @@ class StorageTest < Test::Unit::TestCase
setup
do
rebuild_model
:storage
=>
:s3
,
:bucket
=>
"testing"
,
:path
=>
"
/
:attachment/:style/:basename.:extension"
,
:path
=>
":attachment/:style/:basename.:extension"
,
:s3_credentials
=>
{
'access_key_id'
=>
"12345"
,
'secret_access_key'
=>
"54321"
...
...
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