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
eaf8a006
Commit
eaf8a006
authored
Apr 23, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test helpers
* Force column reset in Rails >= 3.1 * Reuse another helper method
parent
3831498f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
test/helper.rb
+5
-8
No files found.
test/helper.rb
View file @
eaf8a006
...
@@ -65,6 +65,9 @@ def reset_class class_name
...
@@ -65,6 +65,9 @@ def reset_class class_name
include
Paperclip
::
Glue
include
Paperclip
::
Glue
end
end
klass
.
reset_column_information
klass
.
connection_pool
.
clear_table_cache!
(
klass
.
table_name
)
if
klass
.
connection_pool
.
respond_to?
(
:clear_table_cache!
)
klass
.
connection
.
schema_cache
.
clear_table_cache!
(
klass
.
table_name
)
if
klass
.
connection
.
respond_to?
(
:schema_cache
)
klass
klass
end
end
...
@@ -91,15 +94,10 @@ def rebuild_model options = {}
...
@@ -91,15 +94,10 @@ def rebuild_model options = {}
end
end
def
rebuild_class
options
=
{}
def
rebuild_class
options
=
{}
ActiveRecord
::
Base
.
send
(
:include
,
Paperclip
::
Glue
)
reset_class
(
"Dummy"
).
tap
do
|
klass
|
Object
.
send
(
:remove_const
,
"Dummy"
)
rescue
nil
klass
.
has_attached_file
:avatar
,
options
Object
.
const_set
(
"Dummy"
,
Class
.
new
(
ActiveRecord
::
Base
))
Paperclip
.
reset_duplicate_clash_check!
Paperclip
.
reset_duplicate_clash_check!
Dummy
.
class_eval
do
include
Paperclip
::
Glue
has_attached_file
:avatar
,
options
end
end
Dummy
.
reset_column_information
end
end
class
FakeModel
class
FakeModel
...
@@ -116,7 +114,6 @@ class FakeModel
...
@@ -116,7 +114,6 @@ class FakeModel
def
run_paperclip_callbacks
name
,
*
args
def
run_paperclip_callbacks
name
,
*
args
end
end
end
end
def
attachment
(
options
=
{})
def
attachment
(
options
=
{})
...
...
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