Skip to content

Commit

Permalink
[test] always close the client + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Jun 1, 2022
1 parent 58843d8 commit 4f178ea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec/manticore/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
describe Manticore::Client do
let(:client) { Manticore::Client.new }

after { client.close }

it "fetches a URL and return a response" do
expect(client.get(local_server)).to be_a Manticore::Response
end
Expand Down Expand Up @@ -313,11 +315,11 @@
end

describe ":cipher_suites" do
skip
skip 'TODO: someone should write the spec'
end

describe ":protocols" do
skip
skip 'TODO: someone should write the spec'
end
end

Expand Down Expand Up @@ -785,14 +787,13 @@
context "with a misbehaving endpoint" do
let(:port) do
p = 4000
server = nil
begin
server = TCPServer.new p
rescue Errno::EADDRINUSE
p += 1
retry
ensure
server.close
server&.close
end
p
end
Expand All @@ -813,6 +814,7 @@
].join("\n"))
client.close
rescue IOError => e
warn "caught an error: #{e.inspect}"
break
end
end
Expand Down

0 comments on commit 4f178ea

Please sign in to comment.