Sha256: 4b98406b8a7b9e7ab07e401d122a4431bddf17de7f6ad0f044351115880f534e

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

describe Float do
  context "#to_frac" do
    context "1.0" do
      subject { 1.0 }
      it("== 1") { subject.to_frac.should == "1" }
    end
  
    context "1.25" do
      subject { 1.25 }
      it("== 1 1/4") { subject.to_frac.should == "1¼" }
    end

    context "1.5" do
      subject { 1.5 }
      it("== 1 1/2") { subject.to_frac.should == "1½" }
    end

    context "1.75" do
      subject { 1.75 }
      it("== 1 3/4") { subject.to_frac.should == "1¾" }
    end

    context "1.88" do
      subject { 1.88 }
      it("== 1.88") { subject.to_frac.should == '1.88' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sc-core-ext-1.2.1 spec/sc-core-ext/float_spec.rb
sc-core-ext-1.2.0 spec/sc-core-ext/float_spec.rb