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
50770957
Commit
50770957
authored
Aug 29, 2013
by
Sjoerd Andringa
Committed by
Jon Yurek
Nov 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deep merge Attachment options into default_options
parent
efdf952e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
lib/paperclip/attachment.rb
+1
-1
test/attachment_test.rb
+20
-0
No files found.
lib/paperclip/attachment.rb
View file @
50770957
...
@@ -69,7 +69,7 @@ module Paperclip
...
@@ -69,7 +69,7 @@ module Paperclip
@name
=
name
@name
=
name
@instance
=
instance
@instance
=
instance
options
=
self
.
class
.
default_options
.
merge
(
options
)
options
=
self
.
class
.
default_options
.
deep_
merge
(
options
)
@options
=
options
@options
=
options
@post_processing
=
true
@post_processing
=
true
...
...
test/attachment_test.rb
View file @
50770957
...
@@ -62,6 +62,26 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -62,6 +62,26 @@ class AttachmentTest < Test::Unit::TestCase
assert_file_exists
(
dummy
.
avatar
.
path
(
:original
))
assert_file_exists
(
dummy
.
avatar
.
path
(
:original
))
end
end
context
"having a not empty hash as a default option"
do
setup
do
@old_default_options
=
Paperclip
::
Attachment
.
default_options
.
dup
@new_default_options
=
{
:convert_options
=>
{
:all
=>
"-background white"
}
}
Paperclip
::
Attachment
.
default_options
.
merge!
(
@new_default_options
)
end
teardown
do
Paperclip
::
Attachment
.
default_options
.
merge!
(
@old_default_options
)
end
should
"deep merge when it is overridden"
do
new_options
=
{
:convert_options
=>
{
:thumb
=>
"-thumbnailize"
}
}
attachment
=
Paperclip
::
Attachment
.
new
(
:name
,
:instance
,
new_options
)
assert_equal
Paperclip
::
Attachment
.
default_options
.
deep_merge
(
new_options
),
attachment
.
instance_variable_get
(
"@options"
)
end
end
should
"handle a boolean second argument to #url"
do
should
"handle a boolean second argument to #url"
do
mock_url_generator_builder
=
MockUrlGeneratorBuilder
.
new
mock_url_generator_builder
=
MockUrlGeneratorBuilder
.
new
attachment
=
Paperclip
::
Attachment
.
new
(
:name
,
:instance
,
:url_generator
=>
mock_url_generator_builder
)
attachment
=
Paperclip
::
Attachment
.
new
(
:name
,
:instance
,
:url_generator
=>
mock_url_generator_builder
)
...
...
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