diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-01-29 08:37:37 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-01-29 11:36:13 +0900 |
commit | 522adbc945c209f4993b0d0ee84a44c333de350f (patch) | |
tree | fcb7f4fc58e49051ee7cbba12e081bff2291bbe8 /spec/ruby/core | |
parent | f6387ae0737ea19a00caa3af14c489b404c1c0e1 (diff) | |
download | ruby-522adbc945c209f4993b0d0ee84a44c333de350f.tar.gz |
Fixed Kernel#rand spec
Float should not be compared by identity.
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/kernel/rand_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/kernel/rand_spec.rb b/spec/ruby/core/kernel/rand_spec.rb index 481189d969..c52faee2c4 100644 --- a/spec/ruby/core/kernel/rand_spec.rb +++ b/spec/ruby/core/kernel/rand_spec.rb @@ -119,9 +119,9 @@ describe "Kernel.rand" do context "given an inclusive range between 0 and 1" do it "returns an Integer between the two Integers" do - x = rand(0..1) - x.should be_kind_of(Integer) - (0..1).should include(x) + x = rand(0..1) + x.should be_kind_of(Integer) + (0..1).should include(x) end it "returns a Float if at least one side is Float" do @@ -131,8 +131,8 @@ describe "Kernel.rand" do x3 = Random.new(seed).rand(0.0..1) x3.should be_kind_of(Float) - x1.should equal(x3) - x2.should equal(x3) + x1.should eql(x3) + x2.should eql(x3) (0.0..1.0).should include(x3) end @@ -140,9 +140,9 @@ describe "Kernel.rand" do context "given an exclusive range between 0 and 1" do it "returns zero as an Integer" do - x = rand(0...1) - x.should be_kind_of(Integer) - x.should eql(0) + x = rand(0...1) + x.should be_kind_of(Integer) + x.should eql(0) end it "returns a Float if at least one side is Float" do @@ -152,8 +152,8 @@ describe "Kernel.rand" do x3 = Random.new(seed).rand(0.0...1) x3.should be_kind_of(Float) - x1.should equal(x3) - x2.should equal(x3) + x1.should eql(x3) + x2.should eql(x3) (0.0...1.0).should include(x3) end |