Sha256: 133096d77c7719464ab4b36c9fb8c7998c7a60a8414e7c31c7238562d0836d06
Contents?: true
Size: 1.69 KB
Versions: 8
Compression:
Stored size: 1.69 KB
Contents
require_relative '../../../lib/commands' module Unipept class UnipeptConfigTestCase < Unipept::TestCase def test_help out, _err = capture_io_while do assert_raises SystemExit do Commands::Unipept.run(%w(config -h)) end end assert(out.include? 'show help for this command') out, _err = capture_io_while do assert_raises SystemExit do Commands::Unipept.run(%w(config --help)) end end assert(out.include? 'show help for this command') end def test_no_args _out, err = capture_io_while do assert_raises SystemExit do Commands::Unipept.run(%w(config)) end end assert(err.include? 'show help for this command') end def test_too_many_args _out, err = capture_io_while do assert_raises SystemExit do Commands::Unipept.run(%w(config a b c)) end end assert(err.include? 'show help for this command') end def test_setting_config value = Random.rand.to_s config = Unipept::Configuration.new config.delete('test') config.save out, _err = capture_io_while do Commands::Unipept.run(['config', 'test', value]) end assert_equal('test was set to ' + value, out.chomp) assert_equal(value, Unipept::Configuration.new['test']) end def test_getting_config value = Random.rand.to_s config = Unipept::Configuration.new config['test'] = value config.save out, _err = capture_io_while do Commands::Unipept.run(%w(config test)) end config.delete('test') config.save assert_equal(value, out.chomp) end end end
Version data entries
8 entries across 8 versions & 1 rubygems