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
f9cb5a4e
Commit
f9cb5a4e
authored
Jul 17, 2013
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure correct behavior when assigning empty string
parent
e54b5bdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
test/attachment_test.rb
+14
-0
No files found.
test/attachment_test.rb
View file @
f9cb5a4e
...
@@ -985,6 +985,20 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -985,6 +985,20 @@ class AttachmentTest < Test::Unit::TestCase
end
end
end
end
should
'clear out the previous assignment when assigned nil'
do
@attachment
.
assign
(
@file
)
original_file
=
@attachment
.
queued_for_write
[
:original
]
@attachment
.
assign
(
nil
)
assert_nil
@attachment
.
queued_for_write
[
:original
]
end
should
'not do anything when it is assigned an empty string'
do
@attachment
.
assign
(
@file
)
original_file
=
@attachment
.
queued_for_write
[
:original
]
@attachment
.
assign
(
""
)
assert_equal
original_file
,
@attachment
.
queued_for_write
[
:original
]
end
should
"return nil as path when no file assigned"
do
should
"return nil as path when no file assigned"
do
assert_equal
nil
,
@attachment
.
path
assert_equal
nil
,
@attachment
.
path
assert_equal
nil
,
@attachment
.
path
(
:blah
)
assert_equal
nil
,
@attachment
.
path
(
:blah
)
...
...
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