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
af1ae004
Commit
af1ae004
authored
May 10, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made geometry spec case insensitive.
parent
81704d1d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
lib/paperclip/geometry.rb
+1
-1
test/geometry_test.rb
+9
-0
No files found.
lib/paperclip/geometry.rb
View file @
af1ae004
...
...
@@ -26,7 +26,7 @@ module Paperclip
# Parses a "WxH" formatted string, where W is the width and H is the height.
def
self
.
parse
string
if
match
=
(
string
&&
string
.
match
(
/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/
))
if
match
=
(
string
&&
string
.
match
(
/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/
i
))
Geometry
.
new
(
*
match
[
1
,
3
])
end
end
...
...
test/geometry_test.rb
View file @
af1ae004
...
...
@@ -49,6 +49,15 @@ class GeometryTest < Test::Unit::TestCase
assert_nil
@geo
.
modifier
end
should
"treat x and X the same in geometries"
do
@lower
=
Paperclip
::
Geometry
.
parse
(
"123x456"
)
@upper
=
Paperclip
::
Geometry
.
parse
(
"123X456"
)
assert_equal
123
,
@lower
.
width
assert_equal
123
,
@upper
.
width
assert_equal
456
,
@lower
.
height
assert_equal
456
,
@upper
.
height
end
[
'>'
,
'<'
,
'#'
,
'@'
,
'%'
,
'^'
,
'!'
,
nil
].
each
do
|
mod
|
should
"ensure the modifier
#{
mod
.
inspect
}
is preserved"
do
assert
@geo
=
Paperclip
::
Geometry
.
parse
(
"123x456
#{
mod
}
"
)
...
...
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