Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add specs to Range#max and Range#min

The one that fails under 1.9 mode is "(5..5).max.should equal(5)".
  • Loading branch information...
commit 4b483c2cffb893905c2921b9e726dc541c42ddf8 1 parent 6b862e2
@rf- rf- authored
View
7 spec/ruby/core/range/max_spec.rb
@@ -28,9 +28,16 @@
it "returns nil when the endpoint is less than the start point" do
(100..10).max.should be_nil
('z'..'l').max.should be_nil
+ end
+
+ it "returns nil when the endpoint equals the start point and the range is exclusive" do
(5...5).max.should be_nil
end
+ it "returns the endpoint when the endpoint equals the start point and the range is inclusive" do
+ (5..5).max.should equal(5)
+ end
+
ruby_version_is "1.9" do
it "returns nil when the endpoint is less than the start point in a Float range" do
(3003.20..908.1111).max.should be_nil
View
7 spec/ruby/core/range/min_spec.rb
@@ -22,9 +22,16 @@
it "returns nil when the start point is greater than the endpoint" do
(100..10).min.should be_nil
('z'..'l').min.should be_nil
+ end
+
+ it "returns nil when the endpoint equals the start point and the range is exclusive" do
(7...7).min.should be_nil
end
+ it "returns the start point when the endpoint equals the start point and the range is inclusive" do
+ (7..7).min.should equal(7)
+ end
+
ruby_version_is "1.9" do
it "returns nil when the start point is greater than the endpoint in a Float range" do
(3003.20..908.1111).min.should be_nil
Please sign in to comment.
Something went wrong with that request. Please try again.