Skip to content

Commit

Permalink
Fix deleting an item from a list with the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneius committed Jan 8, 2012
1 parent c13fe05 commit 5a384dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/boom/command.rb
Expand Up @@ -108,12 +108,12 @@ def delegate(command, major, minor)
end
end

return search_items(command) if storage.item_exists?(command)

if minor == 'delete' and storage.item_exists?(major)
return delete_item(command, major)
end

return search_items(command) if storage.item_exists?(command)

return create_list(command, major, stdin.read) if !minor && stdin.stat.size > 0
return create_list(command, major, minor)
end
Expand Down
10 changes: 10 additions & 0 deletions test/test_command.rb
Expand Up @@ -220,4 +220,14 @@ def test_delete_item_wrong_list
assert_match /github not found in urlz/, command('urlz github delete')
end

def test_delete_item_different_name
command('foo bar baz')
assert_match /bar is gone forever/, command('foo bar delete')
end

def test_delete_item_same_name
command('duck duck goose')
assert_match /duck is gone forever/, command('duck duck delete')
end

end

0 comments on commit 5a384dd

Please sign in to comment.