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
81b74f6d
Commit
81b74f6d
authored
Jul 15, 2011
by
takuyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add s3_host_name test
parent
0ecaab3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
test/storage_test.rb
+39
-0
No files found.
test/storage_test.rb
View file @
81b74f6d
...
...
@@ -79,6 +79,23 @@ class StorageTest < Test::Unit::TestCase
end
end
context
"S3 Tokyo Region"
do
setup
do
AWS
::
S3
::
Base
.
stubs
(
:establish_connection!
)
rebuild_model
:storage
=>
:s3
,
:s3_credentials
=>
{},
:bucket
=>
"bucket"
,
:path
=>
":attachment/:basename.:extension"
,
:region
=>
"tokyo"
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
StringIO
.
new
(
"."
)
end
should
"return a url based on an S3@tokyo path"
do
assert_match
%r{^http://s3-ap-northeast-1.amazonaws.com/bucket/avatars/stringio.txt}
,
@dummy
.
avatar
.
url
end
end
context
"An attachment that uses S3 for storage and has styles that return different file types"
do
setup
do
AWS
::
S3
::
Base
.
stubs
(
:establish_connection!
)
...
...
@@ -260,6 +277,28 @@ class StorageTest < Test::Unit::TestCase
end
end
context
"Parsing S3 credentials with a region in them"
do
setup
do
AWS
::
S3
::
Base
.
stubs
(
:establish_connection!
)
rebuild_model
:storage
=>
:s3
,
:s3_credentials
=>
{
:production
=>
{
:region
=>
"us"
},
:development
=>
{
:region
=>
"tokyo"
}
}
@dummy
=
Dummy
.
new
end
should
"get the right s3_host_name in production"
do
rails_env
(
"production"
)
assert_match
%r{^s3.amazonaws.com}
,
@dummy
.
avatar
.
s3_host_name
end
should
"get the right s3_host_name in development"
do
rails_env
(
"development"
)
assert_match
%r{^s3-ap-northeast-1.amazonaws.com}
,
@dummy
.
avatar
.
s3_host_name
end
end
context
"An attachment with S3 storage"
do
setup
do
rebuild_model
:storage
=>
:s3
,
...
...
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