File tree Expand file tree Collapse file tree 4 files changed +42
-6
lines changed
strava/api/client/endpoints/routes Expand file tree Collapse file tree 4 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 11# This configuration was generated by
22# `rubocop --auto-gen-config`
3- # on 2025-10-20 02:25:48 UTC using RuboCop version 1.68.0.
3+ # on 2025-10-22 15:51:23 UTC using RuboCop version 1.68.0.
44# The point is for the user to remove these configuration records
55# one by one as the offenses are removed from the code base.
66# Note that changes in the inspected code, or installation of new
@@ -16,6 +16,13 @@ RSpec/AnyInstance:
1616 Exclude :
1717 - ' spec/strava/api/client_spec.rb'
1818
19+ # Offense count: 3
20+ # Configuration parameters: Prefixes, AllowedPatterns.
21+ # Prefixes: when, with, without
22+ RSpec/ContextWording :
23+ Exclude :
24+ - ' spec/strava/api/client/endpoints/routes/export_route_tcx_spec.rb'
25+
1926# Offense count: 5
2027# Configuration parameters: AllowedGroups.
2128RSpec/NestedGroups :
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ group :development, :test do
1717 gem 'rubocop' , '1.68.0'
1818 gem 'rubocop-rake'
1919 gem 'rubocop-rspec'
20+ gem 'tcxread'
2021 gem 'vcr'
2122 gem 'webmock'
2223 gem 'webrick' , '~> 1.7'
Original file line number Diff line number Diff line change 66require 'rspec'
77require 'strava-ruby-client'
88
9+ require 'tempfile'
910require 'multi_xml'
1011require 'gpx'
12+ require 'tcxread'
1113require 'polylines'
1214
1315Dir [ File . join ( File . dirname ( __FILE__ ) , 'support' , '**/*.rb' ) ] . each do |file |
Original file line number Diff line number Diff line change 44
55RSpec . describe 'Strava::Api::Client#export_route_tcx' , vcr : { cassette_name : 'client/export_route_tcx' } do
66 include_context 'with API client'
7- it 'exports a route file' do
8- route = client . export_route_tcx ( id : 16_341_573 )
9- expect ( route ) . to start_with "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n <TrainingCenterDatabase"
107
11- xml = MultiXml . parse ( route )
12- expect ( xml ) . to be_a Hash
8+ context 'an exported route' do
9+ let ( :route ) { client . export_route_tcx ( id : 16_341_573 ) }
10+
11+ it 'is a TrainingCenterDatabase' do
12+ expect ( route ) . to start_with "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n <TrainingCenterDatabase"
13+ end
14+
15+ context 'as xml' do
16+ let ( :xml ) { MultiXml . parse ( route ) }
17+
18+ it 'is valid XML' do
19+ expect ( xml ) . to be_a Hash
20+ end
21+ end
22+
23+ context 'as parsed tcx' do
24+ let ( :tcx ) do
25+ Tempfile . open ( [ 'route' , '.tcx' ] ) do |temp_file |
26+ temp_file . write ( route )
27+ temp_file . close
28+
29+ TCXRead . new ( temp_file . path )
30+ end
31+ end
32+
33+ it 'is valid' do
34+ expect ( tcx ) . to be_a ( TCXRead )
35+ expect ( tcx . total_distance_meters ) . to eq 0
36+ expect ( tcx . total_time_seconds ) . to eq 0
37+ end
38+ end
1339 end
1440
1541 it 'exports a route file by id' do
You can’t perform that action at this time.
0 commit comments