Sha256: 0608a7c076bfc1c9dc7eb15467b0db5eea9b7bc0d06c2f82a64d5b328246fb21

Contents?: true

Size: 453 Bytes

Versions: 4

Compression:

Stored size: 453 Bytes

Contents

RSpec.describe "Float#safe_to_i" do

  it "should convert a float to an integer, if the float is rounded (e.g. 7.0)" do

    float  = 7.0
    result = float.safe_to_i

    expect(result).to eq 7
    expect(result).to be_a Integer

  end

    it "should not convert a float to an integer, if the float is not rounded (e.g. 7.1)" do

    float  = 7.1
    result = float.safe_to_i

    expect(result).to eq 7.1
    expect(result).to be_a Float

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eitil-1.2.4 spec/eitil_core/float/safe_to_i_spec.rb
eitil-1.2.3 spec/eitil_core/float/safe_to_i_spec.rb
eitil-1.2.2 spec/eitil_core/float/safe_to_i_spec.rb
eitil-1.2.1 spec/eitil_core/float/safe_to_i_spec.rb