Sha256: 1d6c1dad5daf2b26d442a5b240fe6929eb9e707a3c1d8817f73832f338f6e287
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
# encoding: utf-8 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.6.0.1 | spec/jldrill/model/Duration_spec.rb |