Sha256: 890501ab10036d6dd8f4ac55f6497df8913521fe64f019c7a9c98566df8c64ce
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' class Test include EggCarton::Helper end module EggCarton describe "Helper" do let(:test) { Test.new } describe "#average" do it "should return 4" do test.average(40, 10).should == 4 end it "should return 4.0" do test.average(40, 10, 1).should == 4.0 end it "should return 0 if denominator is 0" do test.average(10, 0).should == 0 end end describe "#conversion" do it "should return 20%" do test.conversion(2, 4).should == "50%" end it "should return 20.0%" do test.conversion(2, 4, 1).should == "50.0%" end it "should return 0 if denominator is 0" do test.conversion(10, 0).should == 0 end it "should not calculate percentage" do test.conversion(2, 4, 4, :percentage => false).should_not include("%") end it "should return 20.0" do test.conversion(2, 10, 1, :percentage => false).should == "20.0" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
egg_carton-0.2 | spec/egg_carton/helper_spec.rb |