Sha256: 5dc0939405d943ea505578157fab3a484858995f1f2c3355fa107f78b30ae5c3

Contents?: true

Size: 948 Bytes

Versions: 11

Compression:

Stored size: 948 Bytes

Contents

require 'insulin'
require 'spec_helper.rb'

describe Insulin::NDayPeriod do
  load_test_db

  b = Insulin::NDayPeriod.new({
    "start_date" => "2012-06-29",
    "days" => 7,
    "mongo" => @mongo
  })

  it "should contain 4 items" do
    b.size.should == 4
  end

  it "items should be days" do
    b.each do |d|
      d.class.name.should == "Insulin::Day"
    end
  end

  it "should have average glucose of 6.87" do
    ("%0.2f" % b.average_glucose).to_f.should == 6.87
  end

#  c = Insulin::NDayPeriod.new(
#    "start_date" => Time.new.strftime("%F"),
#    "days" => 7,
#    "mongo" => @mongo
#  )
#
#  it "should not go storming off into the future" do
#    c.size.should == 1
#  end

  t = Time.new
  t = t + 86400
  d = Insulin::NDayPeriod.new(
    "start_date" => t.strftime("%F"),
    "days" => 7,
    "mongo" => @mongo
  )

  it "should have nothing if start_date is in the future" do
    d.size.should == 0
  end

  drop_test_db

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
insulin-0.1.11 spec/n_day_period_spec.rb
insulin-0.1.10 spec/n_day_period_spec.rb
insulin-0.1.9 spec/n_day_period_spec.rb
insulin-0.1.8 spec/n_day_period_spec.rb
insulin-0.1.7 spec/n_day_period_spec.rb
insulin-0.1.6 spec/n_day_period_spec.rb
insulin-0.1.5 spec/n_day_period_spec.rb
insulin-0.1.4 spec/n_day_period_spec.rb
insulin-0.1.3 spec/n_day_period_spec.rb
insulin-0.1.2 spec/n_day_period_spec.rb
insulin-0.1.1 spec/n_day_period_spec.rb