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
9aeb3331
Commit
9aeb3331
authored
Jun 21, 2013
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call out problems with parallel tests in the README
Thanks to ericsullivan for pointing this out.
parent
2aeb491f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
README.md
+19
-0
No files found.
README.md
View file @
9aeb3331
...
...
@@ -657,6 +657,25 @@ Paperclip provides rspec-compatible matchers for testing attachments. See the
documentation on
[
Paperclip::Shoulda::Matchers
](
http://rubydoc.info/gems/paperclip/Paperclip/Shoulda/Matchers
)
for more information.
**Parallel Tests**
Because of the default
`path`
for Paperclip storage, if you try to run tests in
parallel, you may find that files get overwritten because the same path is being
calculated for them in each test process. While this fix works for
parallel_tests, a similar concept should be used for any other mechanism for
running tests concurrently.
```
ruby
if
ENV
[
'PARALLEL_TEST_GROUPS'
]
Paperclip
::
Attachment
.
default_options
[
:path
]
=
":rails_root/public/system/:rails_env/
#{
ENV
[
'TEST_ENV_NUMBER'
].
to_i
}
/:class/:attachment/:id_partition/:filename"
else
Paperclip
::
Attachment
.
default_options
[
:path
]
=
":rails_root/public/system/:rails_env/:class/:attachment/:id_partition/:filename"
end
```
The important part here being the inclusion of
`ENV['TEST_ENV_NUMBER']`
, or the
similar mechanism for whichever parallel testing library you use.
Contributing
------------
...
...
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