Sha256: 5861674c71941609553282bd159a976157c8e86e1463cd8130139efa2bfa15f5
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require 'jldrill/model/Duration' module JLDrill describe Duration do it "should create an invalid duration with no argument" do duration = Duration.new duration.seconds.should eql(-1) duration.valid?.should be_false end it "should create a duration of the required length" do duration = Duration.new(52) duration.seconds.should eql(52) duration.valid?.should be_true end it "should parse a duration from a string" do duration = Duration.parse("126") duration.seconds.should eql(126) duration = Duration.parse("abcd") duration.valid?.should be_false duration = Duration.parse("0") duration.seconds.should eql(0) duration.valid?.should be_true end it "should output the duration in days" do fiveDays = Duration.new fiveDays.days = 5.0 fiveDays.seconds.should eql(432000) fiveDays.days.should eql(5.0) end it "should output the duration as a string" do duration = Duration.new(256) duration.to_s.should eql("256") end it "should assign durations properly" do duration = Duration.new(1234) duration2 = Duration.new duration2.assign(duration) duration2.seconds.should eql(duration.seconds) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jldrill-0.5.1.7 | spec/jldrill/model/Duration_spec.rb |