Sha256: 586fd074b36a2d067e9ec8c0da8b03c56bd3c3f9f333b790c581c13e0de314b2

Contents?: true

Size: 474 Bytes

Versions: 109

Compression:

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

109 entries across 109 versions & 1 rubygems

Version Path
epitools-0.4.44 spec/ratio_spec.rb
epitools-0.4.43 spec/ratio_spec.rb
epitools-0.4.42 spec/ratio_spec.rb
epitools-0.4.41 spec/ratio_spec.rb
epitools-0.4.40 spec/ratio_spec.rb
epitools-0.4.39 spec/ratio_spec.rb
epitools-0.4.38 spec/ratio_spec.rb
epitools-0.4.37 spec/ratio_spec.rb
epitools-0.4.36 spec/ratio_spec.rb