Sha256: 2cc64b909596e701603b09516c5f6df196975d6e30e0edffc412adf31ca67cc9

Contents?: true

Size: 347 Bytes

Versions: 48

Compression:

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

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
epitools-0.4.35 spec/ratio_spec.rb
epitools-0.4.34 spec/ratio_spec.rb
epitools-0.4.33 spec/ratio_spec.rb
epitools-0.4.32 spec/ratio_spec.rb
epitools-0.4.31 spec/ratio_spec.rb
epitools-0.4.30 spec/ratio_spec.rb
epitools-0.4.29 spec/ratio_spec.rb
epitools-0.4.28 spec/ratio_spec.rb
epitools-0.4.26 spec/ratio_spec.rb
epitools-0.4.25 spec/ratio_spec.rb
epitools-0.4.24 spec/ratio_spec.rb
epitools-0.4.23 spec/ratio_spec.rb
epitools-0.4.22 spec/ratio_spec.rb
epitools-0.4.21 spec/ratio_spec.rb
epitools-0.4.20 spec/ratio_spec.rb
epitools-0.4.19 spec/ratio_spec.rb
epitools-0.4.18 spec/ratio_spec.rb
epitools-0.4.17 spec/ratio_spec.rb
epitools-0.4.16 spec/ratio_spec.rb
epitools-0.4.15 spec/ratio_spec.rb