test/angelo_spec.rb in angelo-0.5.0 vs test/angelo_spec.rb in angelo-0.5.1
- old
+ new
@@ -30,10 +30,13 @@
get '/wait' do
sleep 3
nil
end
+ get '/responder_test' do
+ end
+
end
it 'responds to http requests properly' do
Angelo::HTTPABLE.each do |m|
__send__ m, '/'
@@ -92,11 +95,11 @@
Actor.remove_action :do_wait
Actor.remove_action :do_get
end
it 'does not crash when receiving unknown http request type' do
- r = HTTP.patch(url('/'))
+ r = HTTP.trace(url('/'))
assert @server.alive?
r.status.must_equal 404
end
it 'does not crash when receiving invalid uri' do
@@ -106,10 +109,14 @@
s.close
assert @server.alive?
r.must_match /400 Bad Request/
end
+ it 'does not append responders to on_close array if on_close is not set' do
+ get '/responder_test', Angelo::SSE_HEADER
+ end
+
end
describe 'headers helper' do
headers_count = 0
@@ -348,10 +355,10 @@
it 'does not parse body when request content-type not set' do
post '/json', obj, {'Content-Type' => ''}
last_response_must_be_json({})
end
- (Angelo::HTTPABLE - [:post, :put]).each do |m|
+ (Angelo::HTTPABLE - [:patch, :post, :put]).each do |m|
it "returns a populated hash for #{m.to_s.upcase} requests" do
send m, '/json?foo=bar'
last_response_must_be_json('foo' => 'bar')
end
end