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
59e52b70
Commit
59e52b70
authored
Jun 30, 2011
by
Mike Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'stest' of
https://github.com/asanghi/paperclip
parents
4d843c9c
e15648c6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
lib/paperclip/attachment.rb
+1
-1
test/style_test.rb
+8
-5
No files found.
lib/paperclip/attachment.rb
View file @
59e52b70
...
@@ -67,7 +67,7 @@ module Paperclip
...
@@ -67,7 +67,7 @@ module Paperclip
def
styles
def
styles
if
@styles
.
respond_to?
(
:call
)
||
!
@normalized_styles
if
@styles
.
respond_to?
(
:call
)
||
!
@normalized_styles
@normalized_styles
=
{}
@normalized_styles
=
ActiveSupport
::
OrderedHash
.
new
(
@styles
.
respond_to?
(
:call
)
?
@styles
.
call
(
self
)
:
@styles
).
each
do
|
name
,
args
|
(
@styles
.
respond_to?
(
:call
)
?
@styles
.
call
(
self
)
:
@styles
).
each
do
|
name
,
args
|
@normalized_styles
[
name
]
=
Paperclip
::
Style
.
new
(
name
,
args
.
dup
,
self
)
@normalized_styles
[
name
]
=
Paperclip
::
Style
.
new
(
name
,
args
.
dup
,
self
)
end
end
...
...
test/style_test.rb
View file @
59e52b70
...
@@ -62,12 +62,12 @@ class StyleTest < Test::Unit::TestCase
...
@@ -62,12 +62,12 @@ class StyleTest < Test::Unit::TestCase
context
"An attachment with style rules in various forms"
do
context
"An attachment with style rules in various forms"
do
setup
do
setup
do
styles
=
ActiveSupport
::
OrderedHash
.
new
styles
[
:aslist
]
=
[
"100x100"
,
:png
]
styles
[
:ashash
]
=
{
:geometry
=>
"100x100"
,
:format
=>
:png
}
styles
[
:asstring
]
=
"100x100"
@attachment
=
attachment
:path
=>
":basename.:extension"
,
@attachment
=
attachment
:path
=>
":basename.:extension"
,
:styles
=>
{
:styles
=>
styles
:aslist
=>
[
"100x100"
,
:png
],
:ashash
=>
{
:geometry
=>
"100x100"
,
:format
=>
:png
},
:asstring
=>
"100x100"
}
end
end
should
"have the right number of styles"
do
should
"have the right number of styles"
do
assert_kind_of
Hash
,
@attachment
.
styles
assert_kind_of
Hash
,
@attachment
.
styles
...
@@ -92,6 +92,9 @@ class StyleTest < Test::Unit::TestCase
...
@@ -92,6 +92,9 @@ class StyleTest < Test::Unit::TestCase
assert_nil
@attachment
.
styles
[
:asstring
].
format
assert_nil
@attachment
.
styles
[
:asstring
].
format
end
end
should
"retain order"
do
assert_equal
[
:aslist
,
:ashash
,
:asstring
],
@attachment
.
styles
.
keys
end
end
end
context
"An attachment with :convert_options"
do
context
"An attachment with :convert_options"
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