Sha256: 07fd01fd43a77af8f33f4b8d95b5ad42b2e37a93832cc729c5b796669e1e7e72

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'insulin'

describe Insulin::OnTrackCsvLine do
  csv = Insulin::OnTrackCsvLine.new %q{199,"Jun 22, 2012 8:01:39 AM",Glucose,,Breakfast,5.7,""} 

  it "should have the correct serial" do
    csv["serial"].should == 199
  end

  it "should have the correct time" do
    csv["time"].should == "08:01:39 BST"
  end

  it "should have the correct date" do
    csv["date"].should == "2012-06-22"
  end

  it "should have the correct type" do
    csv["type"].should == "glucose"
  end

  it "should have a null subtype" do
    csv["subtype"].should == nil
  end

  it "should have the correct tag" do
    csv["tag"].should == "breakfast"
  end

  it "should have the correct value" do
    csv["value"].should == 5.7
  end

  it "should have the correct notes" do
    csv["notes"].should == nil
  end

  csv_with_note = Insulin::OnTrackCsvLine.new %q{266,"Jun 28, 2012 10:21:05 AM",Medication,Humalog,After Breakfast,4.0,"F:2 bacon, 2 toast
N:test note
X:fail note
N:other note"}

  it "should have the correct subtype" do
    csv_with_note["subtype"].should == "humalog"
  end

  it "should have the correct day" do
    csv_with_note["day"].should == "thursday"
  end

  it "should have the correct unixtime" do
    csv_with_note["unixtime"].should == 1340875265
  end

  it "should have the correct notes" do
    csv_with_note["notes"].should == {
      "food" => [
        "2 bacon",
        "2 toast"
      ],
      "note" => [
        "test note",
        "other note"
      ]
    }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
insulin-0.0.13 spec/insulin_on_track_csv_line_spec.rb
insulin-0.0.12 spec/insulin_on_track_csv_line_spec.rb
insulin-0.0.11 spec/insulin_on_track_csv_line_spec.rb
insulin-0.0.10 spec/insulin_on_track_csv_line_spec.rb
insulin-0.0.9 spec/insulin_on_track_csv_line_spec.rb