summaryrefslogtreecommitdiff
path: root/spec/ruby/core/range/initialize_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/range/initialize_spec.rb')
-rw-r--r--spec/ruby/core/range/initialize_spec.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/ruby/core/range/initialize_spec.rb b/spec/ruby/core/range/initialize_spec.rb
index 8caf12b..d2826a5 100644
--- a/spec/ruby/core/range/initialize_spec.rb
+++ b/spec/ruby/core/range/initialize_spec.rb
@@ -28,8 +28,13 @@ describe "Range#initialize" do
end
it "raises a NameError if called on an already initialized Range" do
- -> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
- -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
+ if (0..1).frozen? # Ruby 3.0-
+ -> { (0..1).send(:initialize, 1, 3) }.should raise_error(FrozenError)
+ -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(FrozenError)
+ else
+ -> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
+ -> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
+ end
end
it "raises an ArgumentError if arguments don't respond to <=>" do