diff options
Diffstat (limited to 'spec/ruby/core/complex/to_r_spec.rb')
| -rw-r--r-- | spec/ruby/core/complex/to_r_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/ruby/core/complex/to_r_spec.rb b/spec/ruby/core/complex/to_r_spec.rb index 4559921492..6587ae9e2e 100644 --- a/spec/ruby/core/complex/to_r_spec.rb +++ b/spec/ruby/core/complex/to_r_spec.rb @@ -29,13 +29,21 @@ describe "Complex#to_r" do describe "when the imaginary part is non-zero" do it "raises RangeError" do - -> { Complex(0, 1).to_r }.should raise_error(RangeError) + -> { Complex(0, 1).to_r }.should.raise(RangeError) end end describe "when the imaginary part is Float 0.0" do - it "raises RangeError" do - -> { Complex(0, 0.0).to_r }.should raise_error(RangeError) + ruby_version_is ''...'3.4' do + it "raises RangeError" do + -> { Complex(0, 0.0).to_r }.should.raise(RangeError) + end + end + + ruby_version_is '3.4' do + it "returns a Rational" do + Complex(0, 0.0).to_r.should == 0r + end end end end |
