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
2059c5ea
Commit
2059c5ea
authored
Jun 15, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add #close, #closed? delegation to AbstractAdapter
parent
e5ed0191
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletions
+32
-1
lib/paperclip/io_adapters/abstract_adapter.rb
+8
-0
test/io_adapters/abstract_adapter_test.rb
+24
-1
No files found.
lib/paperclip/io_adapters/abstract_adapter.rb
View file @
2059c5ea
...
@@ -38,6 +38,14 @@ module Paperclip
...
@@ -38,6 +38,14 @@ module Paperclip
@tempfile
.
path
@tempfile
.
path
end
end
def
close
@tempfile
.
close
end
def
closed?
@tempfile
.
closed?
end
private
private
def
destination
def
destination
...
...
test/io_adapters/abstract_adapter_test.rb
View file @
2059c5ea
...
@@ -2,7 +2,7 @@ require './test/helper'
...
@@ -2,7 +2,7 @@ require './test/helper'
class
AbstractAdapterTest
<
Test
::
Unit
::
TestCase
class
AbstractAdapterTest
<
Test
::
Unit
::
TestCase
class
TestAdapter
<
Paperclip
::
AbstractAdapter
class
TestAdapter
<
Paperclip
::
AbstractAdapter
attr_accessor
:path
,
:original_file_name
attr_accessor
:path
,
:original_file_name
,
:tempfile
def
content_type
def
content_type
type_from_file_command
type_from_file_command
...
@@ -18,4 +18,27 @@ class AbstractAdapterTest < Test::Unit::TestCase
...
@@ -18,4 +18,27 @@ class AbstractAdapterTest < Test::Unit::TestCase
assert_equal
"image/png"
,
TestAdapter
.
new
.
content_type
assert_equal
"image/png"
,
TestAdapter
.
new
.
content_type
end
end
end
end
context
"delegation"
do
setup
do
@adapter
=
TestAdapter
.
new
@adapter
.
tempfile
=
stub
(
"Tempfile"
)
end
context
"close"
do
should
"delegate to tempfile"
do
@adapter
.
tempfile
.
stubs
(
:close
)
@adapter
.
close
assert_received
@adapter
.
tempfile
,
:close
end
end
context
"closed?"
do
should
"delegate to tempfile"
do
@adapter
.
tempfile
.
stubs
(
:closed?
)
@adapter
.
closed?
assert_received
@adapter
.
tempfile
,
:closed?
end
end
end
end
end
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