Sha256: 6e01762796322d84ddbfd5ea319e8343327ba9f34376a52b2628e3e69669d08b

Contents?: true

Size: 467 Bytes

Versions: 27

Compression:

Stored size: 467 Bytes

Contents

require 'epitools/ratio'

describe Ratio do

  before :each do
    @a = Ratio[1,1]
    @b = Ratio[1,2]
  end

  it "adds" do
    ( @a + @b ).should == Ratio[2,3]
  end

  it "floats" do
    @a.to_f.should == 1.0
    @b.to_f.should == 0.5
  end

  it "percents" do
    @a.percent.should == "100.0%"
    @b.percent.should == "50.0%"
  end

  it "uses the function-style wrapper" do
    Ratio(1,2).should == Ratio[1,2]
    Ratio(1,2).should == Ratio.new(1,2)
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
epitools-0.5.111 spec/ratio_spec.rb
epitools-0.5.110 spec/ratio_spec.rb
epitools-0.5.109 spec/ratio_spec.rb
epitools-0.5.108 spec/ratio_spec.rb
epitools-0.5.107 spec/ratio_spec.rb
epitools-0.5.106 spec/ratio_spec.rb
epitools-0.5.105 spec/ratio_spec.rb