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
04094b6f
Commit
04094b6f
authored
Jun 15, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup whitespaces
parent
5a138fd9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
18 deletions
+18
-18
features/step_definitions/web_steps.rb
+3
-3
features/support/fixtures/.boot_config.rb.swo
+0
-0
lib/paperclip/matchers.rb
+2
-2
lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
+4
-4
lib/paperclip/storage/fog.rb
+1
-1
lib/paperclip/storage/s3.rb
+1
-1
lib/paperclip/style.rb
+2
-2
test/attachment_test.rb
+5
-5
No files found.
features/step_definitions/web_steps.rb
View file @
04094b6f
...
@@ -181,7 +181,7 @@ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label
...
@@ -181,7 +181,7 @@ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label
end
end
end
end
end
end
Then
/^(?:|I )should be on (.+)$/
do
|
page_name
|
Then
/^(?:|I )should be on (.+)$/
do
|
page_name
|
current_path
=
URI
.
parse
(
current_url
).
path
current_path
=
URI
.
parse
(
current_url
).
path
if
current_path
.
respond_to?
:should
if
current_path
.
respond_to?
:should
...
@@ -195,8 +195,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
...
@@ -195,8 +195,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
query
=
URI
.
parse
(
current_url
).
query
query
=
URI
.
parse
(
current_url
).
query
actual_params
=
query
?
CGI
.
parse
(
query
)
:
{}
actual_params
=
query
?
CGI
.
parse
(
query
)
:
{}
expected_params
=
{}
expected_params
=
{}
expected_pairs
.
rows_hash
.
each_pair
{
|
k
,
v
|
expected_params
[
k
]
=
v
.
split
(
','
)}
expected_pairs
.
rows_hash
.
each_pair
{
|
k
,
v
|
expected_params
[
k
]
=
v
.
split
(
','
)}
if
actual_params
.
respond_to?
:should
if
actual_params
.
respond_to?
:should
actual_params
.
should
==
expected_params
actual_params
.
should
==
expected_params
else
else
...
...
features/support/fixtures/.boot_config.rb.swo
deleted
100644 → 0
View file @
5a138fd9
File deleted
lib/paperclip/matchers.rb
View file @
04094b6f
...
@@ -41,7 +41,7 @@ module Paperclip
...
@@ -41,7 +41,7 @@ module Paperclip
#
#
# class ActiveSupport::TestCase
# class ActiveSupport::TestCase
# extend Paperclip::Shoulda::Matchers
# extend Paperclip::Shoulda::Matchers
#
#
# #...other initializers...#
# #...other initializers...#
# end
# end
#
#
...
@@ -57,7 +57,7 @@ module Paperclip
...
@@ -57,7 +57,7 @@ module Paperclip
# should validate_attachment_size(:avatar).
# should validate_attachment_size(:avatar).
# less_than(2.megabytes)
# less_than(2.megabytes)
# end
# end
#
#
module
Matchers
module
Matchers
end
end
end
end
...
...
lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
View file @
04094b6f
...
@@ -51,7 +51,7 @@ module Paperclip
...
@@ -51,7 +51,7 @@ module Paperclip
end
end
protected
protected
def
accepted_types_and_failures
def
accepted_types_and_failures
if
@allowed_types
.
present?
if
@allowed_types
.
present?
"Accept content types:
#{
@allowed_types
.
join
(
", "
)
}
\n
"
.
tap
do
|
message
|
"Accept content types:
#{
@allowed_types
.
join
(
", "
)
}
\n
"
.
tap
do
|
message
|
...
@@ -61,7 +61,7 @@ module Paperclip
...
@@ -61,7 +61,7 @@ module Paperclip
message
<<
" All were accepted successfully."
message
<<
" All were accepted successfully."
end
end
end
end
end
end
end
end
def
rejected_types_and_failures
def
rejected_types_and_failures
if
@rejected_types
.
present?
if
@rejected_types
.
present?
...
@@ -74,10 +74,10 @@ module Paperclip
...
@@ -74,10 +74,10 @@ module Paperclip
end
end
end
end
end
end
def
expected_attachment
def
expected_attachment
"Expected
#{
@attachment_name
}
:
\n
"
"Expected
#{
@attachment_name
}
:
\n
"
end
end
def
type_allowed?
(
type
)
def
type_allowed?
(
type
)
@subject
.
send
(
"
#{
@attachment_name
}
_content_type="
,
type
)
@subject
.
send
(
"
#{
@attachment_name
}
_content_type="
,
type
)
...
...
lib/paperclip/storage/fog.rb
View file @
04094b6f
...
@@ -197,7 +197,7 @@ module Paperclip
...
@@ -197,7 +197,7 @@ module Paperclip
else
else
@options
[
:fog_directory
]
@options
[
:fog_directory
]
end
end
@directory
||=
connection
.
directories
.
new
(
:key
=>
dir
)
@directory
||=
connection
.
directories
.
new
(
:key
=>
dir
)
end
end
end
end
...
...
lib/paperclip/storage/s3.rb
View file @
04094b6f
...
@@ -61,7 +61,7 @@ module Paperclip
...
@@ -61,7 +61,7 @@ module Paperclip
# Normally, this won't matter in the slightest and you can leave the default (which is
# Normally, this won't matter in the slightest and you can leave the default (which is
# path-style, or :s3_path_url). But in some cases paths don't work and you need to use
# path-style, or :s3_path_url). But in some cases paths don't work and you need to use
# the domain-style (:s3_domain_url). Anything else here will be treated like path-style.
# the domain-style (:s3_domain_url). Anything else here will be treated like path-style.
#
#
# Notes:
# Notes:
# * The value of this option is a string, not a symbol.
# * The value of this option is a string, not a symbol.
# <b>right:</b> <tt>":s3_domain_url"</tt>
# <b>right:</b> <tt>":s3_domain_url"</tt>
...
...
lib/paperclip/style.rb
View file @
04094b6f
...
@@ -52,12 +52,12 @@ module Paperclip
...
@@ -52,12 +52,12 @@ module Paperclip
end
end
def
convert_options
def
convert_options
@convert_options
.
respond_to?
(
:call
)
?
@convert_options
.
call
(
attachment
.
instance
)
:
@convert_options
.
respond_to?
(
:call
)
?
@convert_options
.
call
(
attachment
.
instance
)
:
(
@convert_options
||
attachment
.
send
(
:extra_options_for
,
name
))
(
@convert_options
||
attachment
.
send
(
:extra_options_for
,
name
))
end
end
def
source_file_options
def
source_file_options
@source_file_options
.
respond_to?
(
:call
)
?
@source_file_options
.
call
(
attachment
.
instance
)
:
@source_file_options
.
respond_to?
(
:call
)
?
@source_file_options
.
call
(
attachment
.
instance
)
:
(
@source_file_options
||
attachment
.
send
(
:extra_source_file_options_for
,
name
))
(
@source_file_options
||
attachment
.
send
(
:extra_source_file_options_for
,
name
))
end
end
...
...
test/attachment_test.rb
View file @
04094b6f
...
@@ -744,7 +744,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -744,7 +744,7 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model
rebuild_model
@file
=
Tempfile
.
new
([
"filename"
,
"png"
])
@file
=
Tempfile
.
new
([
"filename"
,
"png"
])
end
end
teardown
do
teardown
do
@file
.
unlink
@file
.
unlink
end
end
...
@@ -752,7 +752,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -752,7 +752,7 @@ class AttachmentTest < Test::Unit::TestCase
context
"with default configuration"
do
context
"with default configuration"
do
"&$+,/:;=?@<>[]{}|
\^
~%# "
.
split
(
//
).
each
do
|
character
|
"&$+,/:;=?@<>[]{}|
\^
~%# "
.
split
(
//
).
each
do
|
character
|
context
"with character
#{
character
}
"
do
context
"with character
#{
character
}
"
do
context
"at beginning of filename"
do
context
"at beginning of filename"
do
setup
do
setup
do
@file
.
stubs
(
:original_filename
).
returns
(
"
#{
character
}
filename.png"
)
@file
.
stubs
(
:original_filename
).
returns
(
"
#{
character
}
filename.png"
)
...
@@ -762,9 +762,9 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -762,9 +762,9 @@ class AttachmentTest < Test::Unit::TestCase
should
"convert special character into underscore"
do
should
"convert special character into underscore"
do
assert_equal
"_filename.png"
,
@dummy
.
avatar
.
original_filename
assert_equal
"_filename.png"
,
@dummy
.
avatar
.
original_filename
end
end
end
end
context
"at end of filename"
do
context
"at end of filename"
do
setup
do
setup
do
@file
.
stubs
(
:original_filename
).
returns
(
"filename.png
#{
character
}
"
)
@file
.
stubs
(
:original_filename
).
returns
(
"filename.png
#{
character
}
"
)
...
@@ -776,7 +776,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -776,7 +776,7 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
"filename.png_"
,
@dummy
.
avatar
.
original_filename
assert_equal
"filename.png_"
,
@dummy
.
avatar
.
original_filename
end
end
end
end
context
"in the middle of filename"
do
context
"in the middle of filename"
do
setup
do
setup
do
@file
.
stubs
(
:original_filename
).
returns
(
"file
#{
character
}
name.png"
)
@file
.
stubs
(
:original_filename
).
returns
(
"file
#{
character
}
name.png"
)
...
...
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