Sha256: 42e3731016b31e6cd7d406e7fd14e8b746a018ae747ace860e65ba814cea1687

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require 'jldrill/model/Quiz/Counter'

module JLDrill
    describe Counter do

        it "should create the ranges properly" do
            counter = Counter.new
            
            counter.levelString(0).should eql("Less than 5 days")
            counter.levelString(1).should eql("5 to 10 days")
            counter.levelString(2).should eql("10 to 19 days")
            counter.levelString(3).should eql("19 to 36 days")
            counter.levelString(4).should eql("36 to 65 days")
            counter.levelString(5).should eql("65 to 107 days")
            counter.levelString(6).should eql("107 to 150 days")
            counter.levelString(7).should eql("More than 150 days")
        end

        def testDuration(item, counter, days,level,count)
            d = JLDrill::Duration.new
            d.days = days
            item.schedule.duration = d.seconds
            counter.count(item)
            counter.table[level].should eql(count)
        end

        it "should count properly" do 
            counter = JLDrill::DurationCounter.new
            item = Item.new
            item.schedule.schedule
            testDuration(item, counter, 3, 0, 1)
            testDuration(item, counter, 8, 1, 1)
            testDuration(item, counter, 17, 2, 1)
            testDuration(item, counter, 25, 3, 1)
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 spec/jldrill/model/Quiz/Counter_spec.rb