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
bb22be30
Commit
bb22be30
authored
Dec 12, 2011
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Net::HTTP instead of curl
There was some problem with command line parsing with a special character.
parent
88a8af95
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
test/helper.rb
+14
-0
test/storage/s3_live_test.rb
+5
-5
No files found.
test/helper.rb
View file @
bb22be30
...
...
@@ -161,3 +161,17 @@ end
def
fixture_file
(
filename
)
File
.
join
(
File
.
dirname
(
__FILE__
),
'fixtures'
,
filename
)
end
def
assert_success_response
(
url
)
Net
::
HTTP
.
get_response
(
URI
.
parse
(
url
))
do
|
response
|
assert_equal
"200"
,
response
.
code
,
"Expected HTTP response code 200, got
#{
response
.
code
}
"
end
end
def
assert_not_found_response
(
url
)
Net
::
HTTP
.
get_response
(
URI
.
parse
(
url
))
do
|
response
|
assert_equal
"404"
,
response
.
code
,
"Expected HTTP response code 404, got
#{
response
.
code
}
"
end
end
test/storage/s3_live_test.rb
View file @
bb22be30
...
...
@@ -91,13 +91,13 @@ unless ENV["S3_BUCKET"].blank?
end
should
"be accessible"
do
assert_
match
/200 OK/
,
`curl -I
#{
@dummy
.
avatar
.
url
}
`
assert_
success_response
@dummy
.
avatar
.
url
end
should
"be destoryable"
do
url
=
@dummy
.
avatar
.
url
@dummy
.
destroy
assert_
match
/404 Not Found/
,
`curl -I
#{
url
}
`
assert_
not_found_response
url
end
end
...
...
@@ -125,17 +125,17 @@ unless ENV["S3_BUCKET"].blank?
end
should
"be accessible"
do
assert_
match
/200 OK/
,
`curl -I "
#{
@dummy
.
avatar
.
url
}
"`
assert_
success_response
@dummy
.
avatar
.
url
end
should
"be accessible with an expiring url"
do
assert_
match
/200 OK/
,
`curl -I "
#{
@dummy
.
avatar
.
expiring_url
}
"`
assert_
success_response
@dummy
.
avatar
.
expiring_url
end
should
"be destroyable"
do
url
=
@dummy
.
avatar
.
url
@dummy
.
destroy
assert_
match
/404 Not Found/
,
`curl -I "
#{
url
}
"`
assert_
not_found_response
url
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