Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
travis seems not to like 'return' in a spec
Browse files Browse the repository at this point in the history
  • Loading branch information
//de committed Mar 24, 2015
1 parent 3996ee4 commit 2b29273
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions spec/reel/unix_server_spec.rb
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

0 comments on commit 2b29273

Please sign in to comment.