This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
travis seems not to like 'return' in a spec
- Loading branch information
//de
committed
Mar 24, 2015
1 parent
3996ee4
commit 2b29273
Showing
1 changed file
with
28 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
require 'spec_helper' | ||
require 'net/http' | ||
|
||
return if defined? JRUBY_VERSION | ||
unless defined?(JRUBY_VERSION) | ||
|
||
RSpec.describe Reel::Server::UNIX do | ||
let(:endpoint) { URI(example_url) } | ||
let(:response_body) { "ohai thar" } | ||
RSpec.describe Reel::Server::UNIX do | ||
let(:endpoint) { URI(example_url) } | ||
let(:response_body) { "ohai thar" } | ||
|
||
it 'allows connections over UNIX sockets' do | ||
ex = nil | ||
it 'allows connections over UNIX sockets' do | ||
ex = nil | ||
|
||
handler = proc do |connection| | ||
begin | ||
request = connection.request | ||
expect( request.method ).to eq 'GET' | ||
connection.respond :ok, self.response_body | ||
handler = proc do |connection| | ||
begin | ||
request = connection.request | ||
expect( request.method ).to eq 'GET' | ||
connection.respond :ok, self.response_body | ||
end | ||
end | ||
end | ||
|
||
Dir::Tmpname.create('reel-sock') do |path| | ||
begin | ||
server = Reel::Server::UNIX.new(path, &handler) | ||
sock = Net::BufferedIO.new Celluloid::IO::UNIXSocket.new(path) | ||
request = Net::HTTP::Get.new('/') | ||
Dir::Tmpname.create('reel-sock') do |path| | ||
begin | ||
server = Reel::Server::UNIX.new(path, &handler) | ||
sock = Net::BufferedIO.new Celluloid::IO::UNIXSocket.new(path) | ||
request = Net::HTTP::Get.new('/') | ||
|
||
request.exec(sock, '1.1', path) | ||
response = Net::HTTPResponse.read_new(sock) | ||
response.reading_body(sock, request.response_body_permitted?) { } | ||
request.exec(sock, '1.1', path) | ||
response = Net::HTTPResponse.read_new(sock) | ||
response.reading_body(sock, request.response_body_permitted?) { } | ||
|
||
expect(response.body).to eq(self.response_body) | ||
ensure | ||
server.terminate if server && server.alive? | ||
expect(response.body).to eq(self.response_body) | ||
ensure | ||
server.terminate if server && server.alive? | ||
end | ||
end | ||
end | ||
|
||
raise ex if ex | ||
raise ex if ex | ||
end | ||
end | ||
end | ||
|
||
end |