Feature: Create GPX Track File
As a user
I want to transform existing gpx routes or multiple gpx tracks to one gpx track
In order to use them on my gps device
Scenario: Create from gpx route files
Given a gpx file named "route1.gpx"
And a gpx file named "route2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(route1.gpx route2.gpx),
output_file: 'track.gpx',
track_name: 'My Name'
)
"""
When I successfully run `./convert.rb`
Then a gpx file named "track.gpx" should exist with "4" track nodes
Scenario: Create from gpx track files
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name'
)
"""
When I successfully run `./convert.rb`
Then a gpx file named "track.gpx" should exist with "4" track nodes
Scenario: Define name
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name'
)
"""
When I successfully run `./convert.rb`
Then the gpx file "track.gpx" should contain:
"""
My Name
"""
Scenario: Normal order track
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name'
)
"""
When I successfully run `./convert.rb`
Then the gpx file "track.gpx" should contain:
"""
WP 3
16.232316396783801
WP 4
16.232316396783801
"""
Scenario: Reverse track
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name',
reverse: true
)
"""
When I successfully run `./convert.rb`
Then the gpx file "track.gpx" should contain:
"""
WP 2
16.232316396783801
WP 1
16.232316396783801
"""
Scenario: Single segment
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name',
single_segment: true
)
"""
When I successfully run `./convert.rb`
Then the gpx file "track.gpx" should contain:
"""
WP 1
15.232316396783801
WP 2
15.232316396783801
WP 3
16.232316396783801
WP 4
16.232316396783801
"""
Scenario: One segment per track file
Given a gpx file named "track1.gpx"
And a gpx file named "track2.gpx"
And a converter script named "convert.rb" with
"""
GpxTrackGenerator::Api.generate(
input_files: %w(track1.gpx track2.gpx),
output_file: 'track.gpx',
track_name: 'My Name',
single_segment: false
)
"""
When I successfully run `./convert.rb`
Then the gpx file "track.gpx" should contain:
"""
WP 1
15.232316396783801
WP 2
15.232316396783801
WP 3
16.232316396783801
WP 4
16.232316396783801
"""