diff options
Diffstat (limited to 'spec/ruby/core/range/minmax_spec.rb')
| -rw-r--r-- | spec/ruby/core/range/minmax_spec.rb | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/spec/ruby/core/range/minmax_spec.rb b/spec/ruby/core/range/minmax_spec.rb index b2b4fd61a1..16c7626ea3 100644 --- a/spec/ruby/core/range/minmax_spec.rb +++ b/spec/ruby/core/range/minmax_spec.rb @@ -17,19 +17,19 @@ describe 'Range#minmax' do range = (@x..) - -> { range.minmax }.should raise_error(RangeError, 'cannot get the maximum of endless range') + -> { range.minmax }.should.raise(RangeError, 'cannot get the maximum of endless range') end it 'raises RangeError or ArgumentError on a beginless range' do range = (..@x) - -> { range.minmax }.should raise_error(StandardError) { |e| + -> { range.minmax }.should.raise(StandardError) { |e| if RangeError === e # error from #min - -> { raise e }.should raise_error(RangeError, 'cannot get the minimum of beginless range') + -> { raise e }.should.raise(RangeError, 'cannot get the minimum of beginless range') else # error from #max - -> { raise e }.should raise_error(ArgumentError, 'comparison of NilClass with MockObject failed') + -> { raise e }.should.raise(ArgumentError, 'comparison of NilClass with MockObject failed') end } end @@ -76,34 +76,32 @@ describe 'Range#minmax' do @x.should_not_receive(:succ) range = (@x...) - -> { range.minmax }.should raise_error(RangeError, 'cannot get the maximum of endless range') + -> { range.minmax }.should.raise(RangeError, 'cannot get the maximum of endless range') end it 'should raise RangeError on a beginless range' do range = (...@x) - -> { range.minmax }.should raise_error(RangeError, + -> { range.minmax }.should.raise(RangeError, /cannot get the maximum of beginless range with custom comparison method|cannot get the minimum of beginless range/) end - ruby_bug "#17014", ""..."3.0" do - it 'should return nil pair if beginning and end are equal without iterating the range' do - @x.should_not_receive(:succ) + it 'should return nil pair if beginning and end are equal without iterating the range' do + @x.should_not_receive(:succ) - (@x...@x).minmax.should == [nil, nil] - end + (@x...@x).minmax.should == [nil, nil] + end - it 'should return nil pair if beginning is greater than end without iterating the range' do - @y.should_not_receive(:succ) + it 'should return nil pair if beginning is greater than end without iterating the range' do + @y.should_not_receive(:succ) - (@y...@x).minmax.should == [nil, nil] - end + (@y...@x).minmax.should == [nil, nil] + end - it 'should return the minimum and maximum values for a non-numeric range by iterating the range' do - @x.should_receive(:succ).once.and_return(@y) + it 'should return the minimum and maximum values for a non-numeric range by iterating the range' do + @x.should_receive(:succ).once.and_return(@y) - (@x...@y).minmax.should == [@x, @x] - end + (@x...@y).minmax.should == [@x, @x] end it 'should return the minimum and maximum values for a numeric range' do @@ -120,7 +118,7 @@ describe 'Range#minmax' do it 'raises TypeError if the end value is not an integer' do range = (0...Float::INFINITY) - -> { range.minmax }.should raise_error(TypeError, 'cannot exclude non Integer end value') + -> { range.minmax }.should.raise(TypeError, 'cannot exclude non Integer end value') end it 'should return the minimum and maximum values according to the provided block by iterating the range' do |
