Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/queue/freeze_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require_relative '../../spec_helper'
require_relative '../../shared/queue/freeze'

describe "Queue#freeze" do
it_behaves_like :queue_freeze, :freeze, -> { Queue.new }
end
6 changes: 6 additions & 0 deletions core/sizedqueue/freeze_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require_relative '../../spec_helper'
require_relative '../../shared/queue/freeze'

describe "SizedQueue#freeze" do
it_behaves_like :queue_freeze, :freeze, -> { SizedQueue.new(1) }
end
18 changes: 18 additions & 0 deletions shared/queue/freeze.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe :queue_freeze, shared: true do
ruby_version_is ""..."3.3" do
it "can be frozen" do
queue = @object.call
queue.freeze
queue.should.frozen?
end
end

ruby_version_is "3.3" do
it "raises an exception when freezing" do
queue = @object.call
-> {
queue.freeze
}.should raise_error(TypeError, "cannot freeze #{queue}")
end
end
end

0 comments on commit a9a34d7

Please sign in to comment.