test/test_command.rb in kaboom-0.3.2 vs test/test_command.rb in kaboom-0.3.3

- old
+ new

@@ -4,10 +4,15 @@ require 'output_interceptor' class TestCommand < Test::Unit::TestCase def setup + [Boom::Platform::Darwin, Boom::Platform::Linux, + Boom::Platform::Windows].each do |klass| + klass.any_instance.stubs('system') + end + IO.stubs(:popen) boom_json :urls end def command(cmd) cmd = cmd.split(' ') if cmd @@ -79,21 +84,18 @@ assert_match /copied https:\/\/github\.com to your clipboard/, command('urls github') end def test_item_open_item - Boom::Platform.stubs(:system).returns('') assert_match /opened https:\/\/github\.com for you/, command('open github') end def test_item_open_specific_item - Boom::Platform.stubs(:system).returns('') assert_match /opened https:\/\/github\.com for you/, command('open urls github') end def test_item_open_lists - Boom::Platform.stubs(:system).returns('') assert_match /opened all of urls for you/, command('open urls') end def test_item_creation assert_match /twitter in urls/, @@ -117,15 +119,10 @@ def test_item_deletion assert_match /github is gone forever/, command('urls github delete') end - def test_edit - Boom::Platform.stubs(:system).returns('') - assert_match 'Make your edits', command('edit') - end - def test_help assert_match 'boom help', command('help') assert_match 'boom help', command('-h') assert_match 'boom help', command('--help') end @@ -179,30 +176,29 @@ end def test_version_long assert_match /#{Boom::VERSION}/, command('--version') end - def test_stdin_pipes stub = Object.new stub.stubs(:stat).returns([1,2]) stub.stubs(:read).returns("http://twitter.com") Boom::Command.stubs(:stdin).returns(stub) assert_match /twitter in urls/, command('urls twitter') end def test_random - Boom::Platform.stubs(:system).returns('') + Boom::Config.any_instance.stubs(:save).returns(true) assert_match /opened .+ for you/, command('random') end def test_random_from_list - Boom::Platform.stubs(:system).returns('') + Boom::Config.any_instance.stubs(:save).returns(true) assert_match /(github|zachholman)/, command('random urls') end def test_random_list_not_exist - Boom::Platform.stubs(:system).returns('') + Boom::Config.any_instance.stubs(:save).returns(true) assert_match /couldn't find that list\./, command('random 39jc02jlskjbbac9') end def test_delete_item_list_not_exist assert_match /couldn't find that list\./, command('urlz github delete')