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
ff3929ee
Commit
ff3929ee
authored
Feb 01, 2011
by
Robert Stern
Committed by
Alex Godin
Jun 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue with uppercase extension and default style on to_s method. Fixes issue #385.
parent
ff0910dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
test/attachment_test.rb
+40
-0
No files found.
test/attachment_test.rb
View file @
ff3929ee
...
...
@@ -634,6 +634,46 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
"sheep_say_bæ.png"
,
@dummy
.
avatar
.
original_filename
end
end
context
"Attachment with uppercase extension and a default style"
do
setup
do
@old_defaults
=
Paperclip
::
Attachment
.
default_options
.
dup
Paperclip
::
Attachment
.
default_options
.
merge!
({
:path
=>
":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
})
FileUtils
.
rm_rf
(
"tmp"
)
rebuild_model
@instance
=
Dummy
.
new
@instance
.
stubs
(
:id
).
returns
123
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"uppercase.PNG"
),
'rb'
)
styles
=
{
:styles
=>
{
:large
=>
[
"400x400"
,
:jpg
],
:medium
=>
[
"100x100"
,
:jpg
],
:small
=>
[
"32x32#"
,
:jpg
]},
:default_style
=>
:small
}
@attachment
=
Paperclip
::
Attachment
.
new
(
:avatar
,
@instance
,
styles
)
now
=
Time
.
now
Time
.
stubs
(
:now
).
returns
(
now
)
@attachment
.
assign
(
@file
)
@attachment
.
save
end
teardown
do
@file
.
close
Paperclip
::
Attachment
.
default_options
.
merge!
(
@old_defaults
)
end
should
"should have matching to_s and url methods"
do
file
=
@attachment
.
to_file
assert
file
assert_match
@attachment
.
to_s
,
@attachment
.
url
assert_match
@attachment
.
to_s
(
:small
),
@attachment
.
url
(
:small
)
file
.
close
end
end
context
"Attachment with uppercase extension and a default style"
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