Sha256: b7af03731fe20e9d720bc37364aef47ea6de860d10f7a77a64596cf8c71b46e2

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Fit::File::Definitions do
  describe ".add_field" do
    context "without additional options" do
      it "adds field data" do
        described_class.add_field(20,5, 'distance')

        described_class.get_field(20,5).should be_a(Hash)
        described_class.get_field(20,5).should eql({ :name => 'distance'})
      end
    end

    context "with additional options" do
      it "adds field data" do
        described_class.add_field(20,5, 'distance', :scale => 100, :units => 'm')

        described_class.get_field(20,5).should be_a(Hash)
        described_class.get_field(20,5).should eql({ :name => 'distance', :scale => 100, :units => 'm'})
      end
    end
  end

  describe ".get_field" do
    it "returns nil if no field exists" do
      described_class.get_field(100,100).should be_nil
    end
  end

  describe ".add_name" do
    it "adds a name" do
      described_class.add_name(20, 'record')
      described_class.get_name(20).should eql('record')
    end
  end

  describe ".get_name" do
    it "returns nil if no name exists" do
      described_class.get_name(100).should be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
garmin-fit-0.0.2 spec/file/definitions_spec.rb