diff options
author | Benoit Daloze <eregontp@gmail.com> | 2024-02-05 16:29:57 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2024-02-05 16:29:57 +0100 |
commit | 40642cd3bc581d3bb402ea5e8e61cdfb868b4f68 (patch) | |
tree | 077cc3ac94f880ce3c8c98322331c01cb1cc9cb8 /spec/ruby/shared/sizedqueue/enque.rb | |
parent | abe07d4bf5f2f848b22e511a647a85c878066adb (diff) |
Update to ruby/spec@3fc4444
Diffstat (limited to 'spec/ruby/shared/sizedqueue/enque.rb')
-rw-r--r-- | spec/ruby/shared/sizedqueue/enque.rb | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/spec/ruby/shared/sizedqueue/enque.rb b/spec/ruby/shared/sizedqueue/enque.rb index 6307f3c3ca..2f25517675 100644 --- a/spec/ruby/shared/sizedqueue/enque.rb +++ b/spec/ruby/shared/sizedqueue/enque.rb @@ -55,7 +55,7 @@ describe :sizedqueue_enq, shared: true do q << 1 t = Thread.new { - q.send(@method, 2, timeout: 1).should == q + q.send(@method, 2, timeout: TIME_TOLERANCE).should == q } Thread.pass until t.status == "sleep" && q.num_waiting == 1 q.pop @@ -82,31 +82,27 @@ describe :sizedqueue_enq, shared: true do it "returns nil if no space is available in time" do q = @object.call(1) q << 1 - t = Thread.new { - q.send(@method, 2, timeout: 0.1).should == nil - } - t.join + Thread.new { + q.send(@method, 2, timeout: 0.001).should == nil + }.join end it "raise TypeError if timeout is not a valid numeric" do q = @object.call(1) - -> { q.send(@method, 2, timeout: "1") }.should raise_error( - TypeError, - "no implicit conversion to float from string", - ) - - -> { q.send(@method, 2, timeout: false) }.should raise_error( - TypeError, - "no implicit conversion to float from false", - ) + -> { + q.send(@method, 2, timeout: "1") + }.should raise_error(TypeError, "no implicit conversion to float from string") + + -> { + q.send(@method, 2, timeout: false) + }.should raise_error(TypeError, "no implicit conversion to float from false") end it "raise ArgumentError if non_block = true is passed too" do q = @object.call(1) - -> { q.send(@method, 2, true, timeout: 1) }.should raise_error( - ArgumentError, - "can't set a timeout if non_block is enabled", - ) + -> { + q.send(@method, 2, true, timeout: 1) + }.should raise_error(ArgumentError, "can't set a timeout if non_block is enabled") end it "raise ClosedQueueError when closed before enqueued" do @@ -120,7 +116,7 @@ describe :sizedqueue_enq, shared: true do q << 1 t = Thread.new { - -> { q.send(@method, 1, timeout: 10) }.should raise_error(ClosedQueueError, "queue closed") + -> { q.send(@method, 1, timeout: TIME_TOLERANCE) }.should raise_error(ClosedQueueError, "queue closed") } Thread.pass until q.num_waiting == 1 |