Sha256: 29b8c5a97a98165dc601e9d8c9bf3eda46092cd6b84fe8efe80d50d25eebe56b

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 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

1 entries across 1 versions & 1 rubygems

Version Path
sc-core-ext-1.1.1 spec/sc-core-ext/float_spec.rb