Permalink
Browse files

Fix misleading message when deleting an item from the wrong list

  • Loading branch information...
1 parent 0e5d6ca commit c13fe057133fd2cb565e42b83585c88a4c15edba @eugeneius eugeneius committed Jan 8, 2012
Showing with 11 additions and 3 deletions.
  1. +6 −3 lib/boom/command.rb
  2. +5 −0 test/test_command.rb
View
@@ -275,9 +275,12 @@ def add_item(list,name,value)
def delete_item(list_name,name)
if storage.list_exists?(list_name)
list = List.find(list_name)
- list.delete_item(name)
- output "#{cyan("Boom!")} #{yellow(name)} is gone forever."
- save
+ if list.delete_item(name)
+ output "#{cyan("Boom!")} #{yellow(name)} is gone forever."
+ save
+ else
+ output "#{yellow(name)} #{red("not found in")} #{yellow(list_name)}"
+ end
else
output "We couldn't find that list."
end
View
@@ -215,4 +215,9 @@ def test_delete_item_list_not_exist
assert_match /couldn't find that list\./, command('urlz github delete')
end
+ def test_delete_item_wrong_list
+ command('urlz twitter https://twitter.com/')
+ assert_match /github not found in urlz/, command('urlz github delete')
+ end
+
end

0 comments on commit c13fe05

Please sign in to comment.