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.136 spec/ratio_spec.rb
epitools-0.5.134 spec/ratio_spec.rb
epitools-0.5.133 spec/ratio_spec.rb
epitools-0.5.131 spec/ratio_spec.rb
epitools-0.5.130 spec/ratio_spec.rb
epitools-0.5.129 spec/ratio_spec.rb
epitools-0.5.128 spec/ratio_spec.rb
epitools-0.5.126 spec/ratio_spec.rb
epitools-0.5.125 spec/ratio_spec.rb
epitools-0.5.124 spec/ratio_spec.rb
epitools-0.5.123 spec/ratio_spec.rb
epitools-0.5.122 spec/ratio_spec.rb
epitools-0.5.121 spec/ratio_spec.rb
epitools-0.5.119 spec/ratio_spec.rb
epitools-0.5.118 spec/ratio_spec.rb
epitools-0.5.116 spec/ratio_spec.rb
epitools-0.5.115 spec/ratio_spec.rb
epitools-0.5.114 spec/ratio_spec.rb
epitools-0.5.113 spec/ratio_spec.rb
epitools-0.5.112 spec/ratio_spec.rb