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.5.103 spec/ratio_spec.rb
epitools-0.5.100 spec/ratio_spec.rb
epitools-0.5.99 spec/ratio_spec.rb
epitools-0.5.98 spec/ratio_spec.rb
epitools-0.5.97 spec/ratio_spec.rb
epitools-0.5.96 spec/ratio_spec.rb
epitools-0.5.95 spec/ratio_spec.rb
epitools-0.5.94 spec/ratio_spec.rb
epitools-0.5.93 spec/ratio_spec.rb
epitools-0.5.92 spec/ratio_spec.rb
epitools-0.5.91 spec/ratio_spec.rb
epitools-0.5.90 spec/ratio_spec.rb
epitools-0.5.89 spec/ratio_spec.rb
epitools-0.5.88 spec/ratio_spec.rb
epitools-0.5.87 spec/ratio_spec.rb
epitools-0.5.86 spec/ratio_spec.rb
epitools-0.5.85 spec/ratio_spec.rb
epitools-0.5.84 spec/ratio_spec.rb
epitools-0.5.83 spec/ratio_spec.rb
epitools-0.5.82 spec/ratio_spec.rb