test/test_command.rb in boom-0.2.2 vs test/test_command.rb in boom-0.2.3
- old
+ new
@@ -64,25 +64,38 @@
def test_list_creation_with_item
assert_match /a new list called newlist.* item in newlist/, command('newlist item blah')
end
+ def test_list_creation_with_item_stdin
+ STDIN.stubs(:read).returns('blah')
+ STDIN.stubs(:stat)
+ STDIN.stat.stubs(:size).returns(4)
+
+ assert_match /a new list called newlist.* item in newlist is blah/, command('newlist item')
+ end
+
def test_item_access
assert_match /copied https:\/\/github\.com to your clipboard/,
command('github')
end
def test_item_access_scoped_by_list
assert_match /copied https:\/\/github\.com to your clipboard/,
command('urls github')
end
- def test_item_open_url
+ 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
@@ -178,6 +191,22 @@
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('')
+ assert_match /opened .+ for you/, command('random')
+ end
+
+ def test_random_from_list
+ Boom::Platform.stubs(:system).returns('')
+ assert_match /(github|zachholman)/, command('random urls')
+ end
+
+ def test_random_list_not_exist
+ Boom::Platform.stubs(:system).returns('')
+ assert_match /couldn't find that list\./, command('random 39jc02jlskjbbac9')
+ end
+
end