diff options
Diffstat (limited to 'spec/ruby/core/range/new_spec.rb')
-rw-r--r-- | spec/ruby/core/range/new_spec.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/ruby/core/range/new_spec.rb b/spec/ruby/core/range/new_spec.rb index a4de4963e7..3cab887799 100644 --- a/spec/ruby/core/range/new_spec.rb +++ b/spec/ruby/core/range/new_spec.rb @@ -42,24 +42,16 @@ describe "Range.new" do end describe "beginless/endless range" do - ruby_version_is ""..."2.7" do - it "does not allow range without left boundary" do - -> { Range.new(nil, 1) }.should raise_error(ArgumentError, /bad value for range/) - end + it "allows beginless left boundary" do + range = Range.new(nil, 1) + range.begin.should == nil end - ruby_version_is "2.7" do - it "allows beginless left boundary" do - range = Range.new(nil, 1) - range.begin.should == nil - end - - it "distinguishes ranges with included and excluded right boundary" do - range_exclude = Range.new(nil, 1, true) - range_include = Range.new(nil, 1, false) + it "distinguishes ranges with included and excluded right boundary" do + range_exclude = Range.new(nil, 1, true) + range_include = Range.new(nil, 1, false) - range_exclude.should_not == range_include - end + range_exclude.should_not == range_include end it "allows endless right boundary" do @@ -73,5 +65,13 @@ describe "Range.new" do range_exclude.should_not == range_include end + + it "creates a frozen range if the class is Range.class" do + Range.new(1, 2).should.frozen? + end + + it "does not create a frozen range if the class is not Range.class" do + Class.new(Range).new(1, 2).should_not.frozen? + end end end |