From fcbe7649c56769a056d1d3a8986214833cbfdbcb Mon Sep 17 00:00:00 2001 From: Andrew Konchin Date: Thu, 12 Oct 2017 21:12:19 +0300 Subject: [PATCH 1/5] Update Bignum specs --- core/bignum/bignum_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/bignum/bignum_spec.rb b/core/bignum/bignum_spec.rb index cf99bb4937..f75699e964 100644 --- a/core/bignum/bignum_spec.rb +++ b/core/bignum/bignum_spec.rb @@ -16,4 +16,10 @@ Bignum.new end.should raise_error(NoMethodError) end + + ruby_version_is '2.4' do + it "is deprecated and unified into Integer" do + Bignum.should == Integer + end + end end From bdf1076d7a3262a9eaf98d4d3c77fa0e427d8a07 Mon Sep 17 00:00:00 2001 From: Andrew Konchin Date: Thu, 12 Oct 2017 21:17:28 +0300 Subject: [PATCH 2/5] Update Fixnum specs --- core/fixnum/fixnum_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/fixnum/fixnum_spec.rb b/core/fixnum/fixnum_spec.rb index 8a050fd25e..48c0c45fcb 100644 --- a/core/fixnum/fixnum_spec.rb +++ b/core/fixnum/fixnum_spec.rb @@ -16,4 +16,10 @@ Fixnum.new end.should raise_error(NoMethodError) end + + ruby_version_is '2.4' do + it "is deprecated and unified into Integer" do + Fixnum.should == Integer + end + end end From 87d73c36f17069a874ccf7309358f807c3139021 Mon Sep 17 00:00:00 2001 From: Andrew Konchin Date: Fri, 13 Oct 2017 20:36:16 +0300 Subject: [PATCH 3/5] Code review. Replace `==` with `equal` and add spec for `Integer` --- core/bignum/bignum_spec.rb | 2 +- core/fixnum/fixnum_spec.rb | 2 +- core/integer/integer_spec.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/bignum/bignum_spec.rb b/core/bignum/bignum_spec.rb index f75699e964..76c70b224e 100644 --- a/core/bignum/bignum_spec.rb +++ b/core/bignum/bignum_spec.rb @@ -19,7 +19,7 @@ ruby_version_is '2.4' do it "is deprecated and unified into Integer" do - Bignum.should == Integer + Bignum.should equal(Integer) end end end diff --git a/core/fixnum/fixnum_spec.rb b/core/fixnum/fixnum_spec.rb index 48c0c45fcb..ff631b5f9a 100644 --- a/core/fixnum/fixnum_spec.rb +++ b/core/fixnum/fixnum_spec.rb @@ -19,7 +19,7 @@ ruby_version_is '2.4' do it "is deprecated and unified into Integer" do - Fixnum.should == Integer + Fixnum.should equal(Integer) end end end diff --git a/core/integer/integer_spec.rb b/core/integer/integer_spec.rb index a6f406cba0..85cb045213 100644 --- a/core/integer/integer_spec.rb +++ b/core/integer/integer_spec.rb @@ -4,6 +4,11 @@ it "includes Comparable" do Integer.include?(Comparable).should == true end + + it "represents big numbers as well" do + 42.class.should equal(Integer) + bignum_value.class.should equal(Integer) + end end describe "Integer#integer?" do From 671746f1cfa17fbf4bba0288a3893f116236899d Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 14 Oct 2017 12:58:08 +0200 Subject: [PATCH 4/5] Add missing version guard and improve description --- core/integer/integer_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/integer/integer_spec.rb b/core/integer/integer_spec.rb index 85cb045213..393f072563 100644 --- a/core/integer/integer_spec.rb +++ b/core/integer/integer_spec.rb @@ -5,9 +5,11 @@ Integer.include?(Comparable).should == true end - it "represents big numbers as well" do - 42.class.should equal(Integer) - bignum_value.class.should equal(Integer) + ruby_version_is "2.4" do + it "is the class of both small and large integers" do + 42.class.should equal(Integer) + bignum_value.class.should equal(Integer) + end end end From 3fe7a407ffdc6838e4eab1584764923b98e1829d Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 14 Oct 2017 13:33:06 +0200 Subject: [PATCH 5/5] Add a spec for deprecation warnings on Fixnum/Bignum --- core/bignum/bignum_spec.rb | 8 +++++++- core/fixnum/fixnum_spec.rb | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/bignum/bignum_spec.rb b/core/bignum/bignum_spec.rb index 76c70b224e..3df43aec2d 100644 --- a/core/bignum/bignum_spec.rb +++ b/core/bignum/bignum_spec.rb @@ -18,8 +18,14 @@ end ruby_version_is '2.4' do - it "is deprecated and unified into Integer" do + it "unified into Integer" do Bignum.should equal(Integer) end + + it "is deprecated" do + -> { + Bignum + }.should complain(/constant ::Bignum is deprecated/) + end end end diff --git a/core/fixnum/fixnum_spec.rb b/core/fixnum/fixnum_spec.rb index ff631b5f9a..7f72f95e94 100644 --- a/core/fixnum/fixnum_spec.rb +++ b/core/fixnum/fixnum_spec.rb @@ -18,8 +18,14 @@ end ruby_version_is '2.4' do - it "is deprecated and unified into Integer" do + it "is unified into Integer" do Fixnum.should equal(Integer) end + + it "is deprecated" do + -> { + Fixnum + }.should complain(/constant ::Fixnum is deprecated/) + end end end