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
bbd6d063
Commit
bbd6d063
authored
Feb 07, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed some file accesses into StringIOs in tests
parent
a23c21e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
test/attachment_test.rb
+4
-8
No files found.
test/attachment_test.rb
View file @
bbd6d063
...
...
@@ -95,14 +95,10 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model
:path
=>
":rails_env/:id.png"
@dummy
=
Dummy
.
new
@dummy
.
stubs
(
:id
).
returns
(
@id
)
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
StringIO
.
new
(
"."
)
@dummy
.
avatar
=
@file
end
teardown
{
@file
.
close
}
should
"return the proper path"
do
temporary_rails_env
(
@rails_env
)
{
assert_equal
"
#{
@rails_env
}
/
#{
@id
}
.png"
,
@dummy
.
avatar
.
path
...
...
@@ -176,7 +172,7 @@ class AttachmentTest < Test::Unit::TestCase
{
:geometry
=>
lambda
{
|
z
|
"50x50#"
}
}
]
geometry_specs
.
each
do
|
geometry_spec
|
context
"An attachment geomtry like
#{
geometry_spec
}
"
do
context
"An attachment geom
e
try like
#{
geometry_spec
}
"
do
setup
do
rebuild_model
:styles
=>
{
:normal
=>
geometry_spec
}
@attachment
=
Dummy
.
new
.
avatar
...
...
@@ -299,7 +295,7 @@ class AttachmentTest < Test::Unit::TestCase
def
do_before_all
;
end
def
do_after_all
;
end
end
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
StringIO
.
new
(
"."
)
@file
.
stubs
(
:to_tempfile
).
returns
(
@file
)
@dummy
=
Dummy
.
new
Paperclip
::
Thumbnail
.
stubs
(
:make
).
returns
(
@file
)
...
...
@@ -346,7 +342,7 @@ class AttachmentTest < Test::Unit::TestCase
context
"Assigning an attachment"
do
setup
do
rebuild_model
:styles
=>
{
:something
=>
"100x100#"
}
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
StringIO
.
new
(
"."
)
@file
.
expects
(
:original_filename
).
returns
(
"5k.png
\n\n
"
)
@file
.
expects
(
:content_type
).
returns
(
"image/png
\n\n
"
)
@file
.
stubs
(
:to_tempfile
).
returns
(
@file
)
...
...
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