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
8a40d68c
Commit
8a40d68c
authored
Jun 30, 2009
by
Nick Quaranto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using File.expand_path when comparing paths since 1.9 treats some as absolute
parent
4f684612
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
test/attachment_test.rb
+3
-5
No files found.
test/attachment_test.rb
View file @
8a40d68c
...
@@ -487,9 +487,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -487,9 +487,7 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model
rebuild_model
@instance
=
Dummy
.
new
@instance
=
Dummy
.
new
@attachment
=
Paperclip
::
Attachment
.
new
(
:avatar
,
@instance
)
@attachment
=
Paperclip
::
Attachment
.
new
(
:avatar
,
@instance
)
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
end
end
teardown
do
teardown
do
...
@@ -550,12 +548,12 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -550,12 +548,12 @@ class AttachmentTest < Test::Unit::TestCase
end
end
should
"return the proper path when filename has a single .'s"
do
should
"return the proper path when filename has a single .'s"
do
assert_equal
"./test/../tmp/avatars/dummies/original/
#{
@instance
.
id
}
/5k.png"
,
@attachment
.
path
assert_equal
File
.
expand_path
(
"./test/../tmp/avatars/dummies/original/
#{
@instance
.
id
}
/5k.png"
),
File
.
expand_path
(
@attachment
.
path
)
end
end
should
"return the proper path when filename has multiple .'s"
do
should
"return the proper path when filename has multiple .'s"
do
@attachment
.
stubs
(
:instance_read
).
with
(
:file_name
).
returns
(
"5k.old.png"
)
@attachment
.
stubs
(
:instance_read
).
with
(
:file_name
).
returns
(
"5k.old.png"
)
assert_equal
"./test/../tmp/avatars/dummies/original/
#{
@instance
.
id
}
/5k.old.png"
,
@attachment
.
path
assert_equal
File
.
expand_path
(
"./test/../tmp/avatars/dummies/original/
#{
@instance
.
id
}
/5k.old.png"
),
File
.
expand_path
(
@attachment
.
path
)
end
end
context
"when expecting three styles"
do
context
"when expecting three styles"
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