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
ae9d7e91
Commit
ae9d7e91
authored
Jul 01, 2010
by
Jake Paul
Committed by
Jon Yurek
Jul 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for broken validate_attachment_content_type matcher (github issue 211)
parent
44b02fac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
+2
-1
test/matchers/validate_attachment_content_type_matcher_test.rb
+10
-0
No files found.
lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
View file @
ae9d7e91
...
...
@@ -57,7 +57,8 @@ module Paperclip
file
=
StringIO
.
new
(
"."
)
file
.
content_type
=
type
(
subject
=
@subject
.
new
).
attachment_for
(
@attachment_name
).
assign
(
file
)
subject
.
valid?
&&
subject
.
errors
[
:"
#{
@attachment_name
}
_content_type"
].
blank?
subject
.
valid?
subject
.
errors
[
:"
#{
@attachment_name
}
_content_type"
].
blank?
end
end
...
...
test/matchers/validate_attachment_content_type_matcher_test.rb
View file @
ae9d7e91
...
...
@@ -4,6 +4,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
context
"validate_attachment_content_type"
do
setup
do
reset_table
(
"dummies"
)
do
|
d
|
d
.
string
:title
d
.
string
:avatar_file_name
d
.
string
:avatar_content_type
end
...
...
@@ -33,5 +34,14 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
should_accept_dummy_class
end
context
"given a class with other validations but matching types"
do
setup
do
@dummy_class
.
validates_presence_of
:title
@dummy_class
.
validates_attachment_content_type
:avatar
,
:content_type
=>
%r{image/.*}
end
should_accept_dummy_class
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