spec/lib/tomatoharvest/cli_spec.rb in tomatoharvest-0.0.1 vs spec/lib/tomatoharvest/cli_spec.rb in tomatoharvest-0.1.0

- old
+ new

@@ -20,10 +20,22 @@ expect(out).to match(/id name\n\s*1 foo\n\s*2 bar/) end end + describe 'remove' do + before do + TomatoHarvest::CLI.start ['add', 'foo'] + end + + it 'removes task from the list' do + out = capture_io { TomatoHarvest::CLI.start ['remove', 1] }.join '' + expect(out).to match(/1 removed/) + end + + end + describe 'start' do before do TomatoHarvest::CLI.start ['add', 'foo'] end @@ -46,20 +58,27 @@ domain: 'domain', username: 'user', password: 'password' } - path = TomatoHarvest::Config::CONFIG_PATH - File.open(path, 'w') do |file| - YAML::dump(options, file) - end + path = TomatoHarvest::Config.config_path(TomatoHarvest::Config::GLOBAL_DIR) + create_yaml_file(path, options) end it 'starts the timer with specified length' do out = capture_io { TomatoHarvest::CLI.start ['start', 1] }.join '' expect(out).to match(/Timer started for foo/) end + end + + end + + describe 'stop' do + + it 'warns when timer isnt running' do + out = capture_io { TomatoHarvest::CLI.start ['stop'] }.join '' + expect(out).to match(/Timer not running/) end end end