spec/celluloid/io/unix_server_spec.rb in celluloid-io-0.16.2 vs spec/celluloid/io/unix_server_spec.rb in celluloid-io-0.16.5.pre0
- old
+ new
@@ -1,31 +1,36 @@
require 'spec_helper'
describe Celluloid::IO::UNIXServer do
- describe "#accept" do
- before do
- pending "JRuby support" if defined?(JRUBY_VERSION)
+
+ if RUBY_PLATFORM == 'java'
+ before(:each) do
+ pending "jRuby support"
+ fail "Avoid potential deadlock under jRuby"
end
+ end
+ describe "#accept" do
+
let(:payload) { 'ohai' }
context "inside Celluloid::IO" do
it "should be evented" do
with_unix_server do |subject|
- within_io_actor { Celluloid::IO.evented? }.should be_true
+ expect(within_io_actor { Celluloid::IO.evented? }).to be_truthy
end
end
it "accepts a connection and returns a Celluloid::IO::UNIXSocket" do
with_unix_server do |subject|
thread = Thread.new { UNIXSocket.new(example_unix_sock) }
peer = within_io_actor { subject.accept }
- peer.should be_a Celluloid::IO::UNIXSocket
+ expect(peer).to be_a Celluloid::IO::UNIXSocket
client = thread.value
client.write payload
- peer.read(payload.size).should eq payload
+ expect(peer.read(payload.size)).to eq payload
end
end
it "raises if server already up" do
with_unix_server do |subject|
@@ -38,22 +43,22 @@
end
context "outside Celluloid::IO" do
it "should be blocking" do
with_unix_server do |subject|
- Celluloid::IO.should_not be_evented
+ expect(Celluloid::IO).not_to be_evented
end
end
it "accepts a connection and returns a Celluloid::IO::UNIXSocket" do
with_unix_server do |subject|
thread = Thread.new { UNIXSocket.new(example_unix_sock) }
peer = subject.accept
- peer.should be_a Celluloid::IO::UNIXSocket
+ expect(peer).to be_a Celluloid::IO::UNIXSocket
client = thread.value
client.write payload
- peer.read(payload.size).should eq payload
+ expect(peer.read(payload.size)).to eq payload
end
end
it "raises if server already up" do
with_unix_server do |subject|