fit_parser 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module FitParser
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Data do
3
+ describe FitParser::File::Data do
4
4
  describe ".generate" do
5
5
  context 'standard definition' do
6
6
  let(:definition) do
7
- Fit::File::Definition.read example_file('record/message/definition')
7
+ FitParser::File::Definition.read example_file('record/message/definition')
8
8
  end
9
9
 
10
10
  subject { described_class.generate(definition) }
@@ -15,21 +15,21 @@ describe Fit::File::Data do
15
15
 
16
16
  context 'definition with multiple time the same field' do
17
17
  before :all do
18
- @fields = Fit::File::Definitions.class_variable_get :@@fields
19
- @dyn_fields = Fit::File::Definitions.class_variable_get :@@dyn_fields
18
+ @fields = FitParser::File::Definitions.class_variable_get :@@fields
19
+ @dyn_fields = FitParser::File::Definitions.class_variable_get :@@dyn_fields
20
20
  # force a fake definition for scaling of arrays
21
- Fit::File::Definitions.add_field 2, 2, "field_array", :type => 6, :scale => 10, :offset => 0
21
+ FitParser::File::Definitions.add_field 2, 2, "field_array", :type => 6, :scale => 10, :offset => 0
22
22
  end
23
23
 
24
24
  after :all do
25
- Fit::File::Definitions.class_variable_set :@@fields, @fields
26
- Fit::File::Definitions.class_variable_set :@@dyn_fields, @dyn_fields
25
+ FitParser::File::Definitions.class_variable_set :@@fields, @fields
26
+ FitParser::File::Definitions.class_variable_set :@@dyn_fields, @dyn_fields
27
27
  end
28
28
 
29
29
  before :each do
30
30
  def_file = example_file('record/message/definition_field_array.fit')
31
31
  data_file = example_file('record/message/data_field_array.fit')
32
- definition = described_class.generate(Fit::File::Definition.read def_file)
32
+ definition = described_class.generate(FitParser::File::Definition.read def_file)
33
33
  @result = definition.read( data_file )
34
34
  end
35
35
 
@@ -61,7 +61,7 @@ describe Fit::File::Data do
61
61
  before :each do
62
62
  def_file = example_file('record/message/definition_dynamic_fields.fit')
63
63
  data_file = example_file('record/message/data_dynamic_fields.fit')
64
- definition = described_class.generate(Fit::File::Definition.read def_file)
64
+ definition = described_class.generate(FitParser::File::Definition.read def_file)
65
65
  @result = definition.read( data_file )
66
66
  end
67
67
 
@@ -75,7 +75,7 @@ describe Fit::File::Data do
75
75
  before :each do
76
76
  def_file = example_file('record/message/definition_dynamic_fields.fit')
77
77
  data_file = example_file('record/message/data_dynamic_fields.fit')
78
- definition = described_class.generate(Fit::File::Definition.read def_file)
78
+ definition = described_class.generate(FitParser::File::Definition.read def_file)
79
79
  @result = definition.read( data_file )
80
80
  end
81
81
 
@@ -88,7 +88,7 @@ describe Fit::File::Data do
88
88
  context 'definition with bit field types' do
89
89
  before :each do
90
90
  def_file = example_file('record/message/definition_file_capabilities.fit')
91
- @definition = described_class.generate(Fit::File::Definition.read def_file)
91
+ @definition = described_class.generate(FitParser::File::Definition.read def_file)
92
92
  end
93
93
 
94
94
  context 'when only 1 bit set' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Definition do
3
+ describe FitParser::File::Definition do
4
4
  context "given a sample definition message" do
5
5
  describe ".read" do
6
6
  subject do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  # we use undefined numbers for field otherwise we interfere
4
4
  # with already defined fields in definitions.rb and test are
5
5
  # not really independant of the code
6
- describe Fit::File::Definitions do
6
+ describe FitParser::File::Definitions do
7
7
  describe ".add_field" do
8
8
  before :all do
9
9
  @fields = described_class.class_variable_get :@@fields
@@ -11,14 +11,14 @@ describe Fit::File::Definitions do
11
11
  end
12
12
 
13
13
  after :all do
14
- Fit::File::Definitions.class_variable_set(:@@fields, @fields)
15
- Fit::File::Definitions.class_variable_set(:@@dyn_fields, @dyn_fields)
14
+ FitParser::File::Definitions.class_variable_set(:@@fields, @fields)
15
+ FitParser::File::Definitions.class_variable_set(:@@dyn_fields, @dyn_fields)
16
16
  end
17
17
 
18
18
  context "without additional options" do
19
19
  before :each do
20
- Fit::File::Definitions.class_variable_set(:@@fields, Hash.new { |h,k| h[k]={} })
21
- Fit::File::Definitions.class_variable_set(:@@dyn_fields, Hash.new { |h,k| h[k]={} })
20
+ FitParser::File::Definitions.class_variable_set(:@@fields, Hash.new { |h,k| h[k]={} })
21
+ FitParser::File::Definitions.class_variable_set(:@@dyn_fields, Hash.new { |h,k| h[k]={} })
22
22
  described_class.add_field(999, 999, 'rspec_test')
23
23
  end
24
24
 
@@ -34,8 +34,8 @@ describe Fit::File::Definitions do
34
34
 
35
35
  context "with additional options" do
36
36
  before :each do
37
- Fit::File::Definitions.class_variable_set(:@@fields, Hash.new { |h,k| h[k]={} })
38
- Fit::File::Definitions.class_variable_set(:@@dyn_fields, Hash.new { |h,k| h[k]={} })
37
+ FitParser::File::Definitions.class_variable_set(:@@fields, Hash.new { |h,k| h[k]={} })
38
+ FitParser::File::Definitions.class_variable_set(:@@dyn_fields, Hash.new { |h,k| h[k]={} })
39
39
 
40
40
  described_class.add_field(999, 999, 'rspec_test', :scale => 100, :units => 'm')
41
41
  described_class.add_field(999, 999, 'rspec_test_dyn', :type => 4, :scale => 10, :offset => 10, :ref_field_name => nil, :ref_field_values => nil)
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Header do
3
+ describe FitParser::File::Header do
4
4
  context "given a sample FIT header" do
5
5
  subject do
6
6
  described_class.read example_file('file/header')
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::RecordHeader do
3
+ describe FitParser::File::RecordHeader do
4
4
  context "given a sample normal header" do
5
5
  subject do
6
6
  described_class.read example_file('record/normal_header')
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Record do
3
+ describe FitParser::File::Record do
4
4
  before do
5
5
  described_class.clear_definitions!
6
6
  described_class.read(example_file('record/definition_record_2.fit'))
@@ -12,8 +12,8 @@ describe Fit::File::Record do
12
12
  context "given a sample definition record" do
13
13
  let(:file) { example_file('record/definition_record') }
14
14
 
15
- it { expect(subject.header).to be_a Fit::File::RecordHeader }
16
- it { expect(subject.content).to be_a Fit::File::Definition }
15
+ it { expect(subject.header).to be_a FitParser::File::RecordHeader }
16
+ it { expect(subject.content).to be_a FitParser::File::Definition }
17
17
 
18
18
  end
19
19
 
@@ -27,7 +27,7 @@ describe Fit::File::Record do
27
27
 
28
28
  let(:file) { example_file('record/data_record_2.fit') }
29
29
 
30
- its(:header) { should be_a(Fit::File::RecordHeader) }
30
+ its(:header) { should be_a(FitParser::File::RecordHeader) }
31
31
  it { expect(subject.content.raw_version).to be == 250 }
32
32
  it { expect(subject.content.raw_part_number).to be == '123-A1234-00' }
33
33
  end
@@ -36,7 +36,7 @@ describe Fit::File::Record do
36
36
 
37
37
  let(:file) { example_file('record/data_record_2bis.fit') }
38
38
 
39
- its(:header) { should be_a(Fit::File::RecordHeader) }
39
+ its(:header) { should be_a(FitParser::File::RecordHeader) }
40
40
  it { expect(subject.content.raw_version).to be == 251 }
41
41
  it { expect(subject.content.version).to be == 2.51 }
42
42
  it { expect(subject.content.raw_part_number).to be == '123-A1234' }
@@ -1,20 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Type do
3
+ describe FitParser::File::Type do
4
4
  before :all do
5
- @types = Fit::File::Types.class_variable_get :@@types
6
- Fit::File::Types.add_type(:int_type, :sint8)
7
- Fit::File::Types.add_type(:int_type_with_val, :uint8, :values => {1 => 'one', 2 => 'two', 3 => 'three'})
5
+ @types = FitParser::File::Types.class_variable_get :@@types
6
+ FitParser::File::Types.add_type(:int_type, :sint8)
7
+ FitParser::File::Types.add_type(:int_type_with_val, :uint8, :values => {1 => 'one', 2 => 'two', 3 => 'three'})
8
8
  end
9
9
 
10
10
  after :all do
11
- Fit::File::Types.class_variable_set(:@@types, @types)
11
+ FitParser::File::Types.class_variable_set(:@@types, @types)
12
12
  end
13
13
 
14
14
  describe '.get_type' do
15
15
  context 'when valid name' do
16
16
  it 'returns a type' do
17
- expect(described_class.get_type(:int_type)).to be_a Fit::File::Type
17
+ expect(described_class.get_type(:int_type)).to be_a FitParser::File::Type
18
18
  end
19
19
 
20
20
  it 'returns always the same instance' do
@@ -1,17 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File::Types do
3
+ describe FitParser::File::Types do
4
4
  before :all do
5
5
  @types = described_class.class_variable_get :@@types
6
6
  end
7
7
 
8
8
  after :all do
9
- Fit::File::Types.class_variable_set(:@@types, @types)
9
+ FitParser::File::Types.class_variable_set(:@@types, @types)
10
10
  end
11
11
 
12
12
  describe '.add_type' do
13
13
  before :each do
14
- Fit::File::Types.class_variable_set(:@@types, Hash.new { |h,k| h[k]={} })
14
+ FitParser::File::Types.class_variable_set(:@@types, Hash.new { |h,k| h[k]={} })
15
15
  end
16
16
 
17
17
  context 'for enum type' do
data/spec/file_spec.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit::File do
3
+ describe FitParser::File do
4
4
  let(:file) { described_class.read( example_file('file/full_file_with_wrong_crc.fit') ) }
5
5
 
6
6
  it 'should have a header' do
7
- expect(file.header).to be_a Fit::File::Header
7
+ expect(file.header).to be_a FitParser::File::Header
8
8
  end
9
9
 
10
10
  it 'should have records' do
11
11
  expect(file.records).to be_a Array
12
- expect(file.records[0]).to be_a Fit::File::Record
12
+ expect(file.records[0]).to be_a FitParser::File::Record
13
13
  end
14
14
 
15
15
  it 'should have a CRC' do
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Fit do
3
+ describe FitParser do
4
4
  describe "VERSION" do
5
- subject{ Fit::VERSION }
5
+ subject{ FitParser::VERSION }
6
6
 
7
7
  it { is_expected.to be_a(String) }
8
8
  it { is_expected.to match(/\d{1,2}\.\d{1,2}\.\d{1,2}/) }
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,7 @@ $LOAD_PATH.unshift SPEC_ROOT, File.join(SPEC_ROOT, '..', 'lib')
8
8
 
9
9
  require 'rspec'
10
10
  require 'rspec/its'
11
- require 'fit'
11
+ require 'fit_parser'
12
12
 
13
13
  RSpec.configure do |config|
14
14
  config.raise_errors_for_deprecations!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dima Mescheryakov
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.0
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +185,7 @@ files:
185
185
  - spec/file/type_spec.rb
186
186
  - spec/file/types_spec.rb
187
187
  - spec/file_spec.rb
188
- - spec/fit_spec.rb
188
+ - spec/fit_parser_spec.rb
189
189
  - spec/spec_helper.rb
190
190
  - spec/support/examples/file/full_file_with_wrong_crc.fit
191
191
  - spec/support/examples/file/header