From bdc7d05a19747b68d10eb0303c3472571aa3ce61 Mon Sep 17 00:00:00 2001 From: Chris Schlaeger Date: Mon, 17 Nov 2014 03:11:53 +0100 Subject: New: Add 'set' option to change name, type and subtype of activities. --- spec/PostRunner_spec.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'spec') diff --git a/spec/PostRunner_spec.rb b/spec/PostRunner_spec.rb index ac67c80..e146e3f 100644 --- a/spec/PostRunner_spec.rb +++ b/spec/PostRunner_spec.rb @@ -113,6 +113,39 @@ describe PostRunner::Main do list.index('foobar').should be_a(Fixnum) end + it 'should fail when setting bad attribute' do + lambda { postrunner(%w( set foo bar :1)) }.should raise_error SystemExit + end + + it 'should set name for FILE2.FIT activity' do + postrunner(%w( set name foobar :1 )) + list = postrunner(%w( list )) + list.index('FILE2.FIT').should be_nil + list.index('foobar').should be_a(Fixnum) + end + + it 'should set activity type for FILE2.FIT activity' do + postrunner(%w( set type Cycling :1 )) + list = postrunner(%w( summary :1 )) + list.index('Running').should be_nil + list.index('Cycling').should be_a(Fixnum) + end + + it 'should fail when setting bad activity type' do + lambda { postrunner(%w( set type foobar :1)) }.should raise_error SystemExit + end + + it 'should set activity subtype for FILE2.FIT activity' do + postrunner(%w( set subtype Road :1 )) + list = postrunner(%w( summary :1 )) + list.index('Generic').should be_nil + list.index('Road').should be_a(Fixnum) + end + + it 'should fail when setting bad activity subtype' do + lambda { postrunner(%w( set subtype foobar :1)) }.should raise_error SystemExit + end + it 'should dump an activity from the archive' do postrunner(%w( dump :1 )) end -- cgit v1.2.3