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
0efa3843
Commit
0efa3843
authored
Mar 02, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip post processing on the size matcher
Fixes #646
parent
c95609bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/paperclip/matchers/validate_attachment_size_matcher.rb
+3
-0
test/matchers/validate_attachment_size_matcher_test.rb
+14
-0
No files found.
lib/paperclip/matchers/validate_attachment_size_matcher.rb
View file @
0efa3843
...
...
@@ -67,9 +67,12 @@ module Paperclip
override_method
(
file
,
:size
){
new_size
}
override_method
(
file
,
:to_tempfile
){
file
}
@subject
.
send
(
@attachment_name
).
post_processing
=
false
@subject
.
send
(
@attachment_name
).
assign
(
file
)
@subject
.
valid?
@subject
.
errors
[
:"
#{
@attachment_name
}
_file_size"
].
blank?
ensure
@subject
.
send
(
@attachment_name
).
post_processing
=
true
end
def
lower_than_low?
...
...
test/matchers/validate_attachment_size_matcher_test.rb
View file @
0efa3843
...
...
@@ -68,5 +68,19 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
assert_rejects
@matcher
,
@dummy
end
end
context
"post processing"
do
setup
do
@dummy_class
.
validates_attachment_size
:avatar
,
:greater_than
=>
1024
@dummy
=
@dummy_class
.
new
@matcher
=
self
.
class
.
validate_attachment_size
(
:avatar
).
greater_than
(
1024
)
end
should
"be skipped"
do
@dummy
.
avatar
.
expects
(
:post_process
).
never
assert_accepts
@matcher
,
@dummy
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