mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
fix tests for new code
This commit is contained in:
parent
80b3f6b0be
commit
d5493d4d23
3 changed files with 5 additions and 29 deletions
10
Gemfile.lock
10
Gemfile.lock
|
@ -53,7 +53,7 @@ GEM
|
||||||
rack (>= 1.1.0)
|
rack (>= 1.1.0)
|
||||||
uuidtools (~> 2.1.1)
|
uuidtools (~> 2.1.1)
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
domain_name (0.5.20160310)
|
domain_name (0.5.20160826)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
drydock (0.6.9)
|
drydock (0.6.9)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
|
@ -77,12 +77,12 @@ GEM
|
||||||
hoe (3.14.2)
|
hoe (3.14.2)
|
||||||
rake (>= 0.8, < 11.0)
|
rake (>= 0.8, < 11.0)
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
http (2.0.1)
|
http (2.0.3)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
http-cookie (~> 1.0)
|
http-cookie (~> 1.0)
|
||||||
http-form_data (~> 1.0.1)
|
http-form_data (~> 1.0.1)
|
||||||
http_parser.rb (~> 0.6.0)
|
http_parser.rb (~> 0.6.0)
|
||||||
http-cookie (1.0.2)
|
http-cookie (1.0.3)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
http-form_data (1.0.1)
|
http-form_data (1.0.1)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
|
@ -231,7 +231,7 @@ GEM
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.2)
|
unf_ext (0.0.7.2)
|
||||||
uuidtools (2.1.5)
|
uuidtools (2.1.5)
|
||||||
webmock (1.24.2)
|
webmock (2.1.0)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff
|
hashdiff
|
||||||
|
@ -321,4 +321,4 @@ DEPENDENCIES
|
||||||
zipruby
|
zipruby
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.12.1
|
1.12.5
|
||||||
|
|
|
@ -5,18 +5,6 @@ describe DeleteCacheWorker do
|
||||||
@test_ip = '10.0.0.1'
|
@test_ip = '10.0.0.1'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'throws exception without 200 or 404 http status' do
|
|
||||||
stub_request(:get, "http://#{@test_ip}/:cache/purge/test.jpg").
|
|
||||||
with(headers: {'Host' => 'kyledrake.neocities.org'})
|
|
||||||
.to_return(status: 503)
|
|
||||||
|
|
||||||
worker = DeleteCacheWorker.new
|
|
||||||
|
|
||||||
proc {
|
|
||||||
worker.perform @test_ip, 'kyledrake', '/test.jpg'
|
|
||||||
}.must_raise RestClient::ServiceUnavailable
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'handles 404 without exception' do
|
it 'handles 404 without exception' do
|
||||||
stub_request(:get, "http://#{@test_ip}/:cache/purge/test.jpg").
|
stub_request(:get, "http://#{@test_ip}/:cache/purge/test.jpg").
|
||||||
with(headers: {'Host' => 'kyledrake.neocities.org'})
|
with(headers: {'Host' => 'kyledrake.neocities.org'})
|
||||||
|
|
|
@ -5,18 +5,6 @@ describe PurgeCacheWorker do
|
||||||
@test_ip = '10.0.0.1'
|
@test_ip = '10.0.0.1'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'throws exception without 200 or 404 http status' do
|
|
||||||
stub_request(:head, "http://#{@test_ip}/test.jpg").
|
|
||||||
with(headers: {'Host' => 'kyledrake.neocities.org', 'Cache-Purge' => '1'})
|
|
||||||
.to_return(status: 503)
|
|
||||||
|
|
||||||
worker = PurgeCacheWorker.new
|
|
||||||
|
|
||||||
proc {
|
|
||||||
worker.perform @test_ip, 'kyledrake', '/test.jpg'
|
|
||||||
}.must_raise RestClient::ServiceUnavailable
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'handles 404 without exception' do
|
it 'handles 404 without exception' do
|
||||||
stub_request(:head, "http://#{@test_ip}/test.jpg").
|
stub_request(:head, "http://#{@test_ip}/test.jpg").
|
||||||
with(headers: {'Host' => 'kyledrake.neocities.org', 'Cache-Purge' => '1'})
|
with(headers: {'Host' => 'kyledrake.neocities.org', 'Cache-Purge' => '1'})
|
||||||
|
|
Loading…
Add table
Reference in a new issue