Skip to content

Commit

Permalink
Make sure deleted object's entries are removed from object_types
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoasleep committed Sep 30, 2019
1 parent 1aae740 commit 3a4c122
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/yard/registry_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ def put(key, value)
# Deletes an object at a given path
# @param [#to_sym] key the key to delete
# @return [void]
def delete(key) @store.delete(key.to_sym) end
def delete(key)
if @store[key.to_sym]
@object_types[@store[key.to_sym].type].delete(key.to_s)
@store.delete(key.to_sym)
end
end

# Gets all path names from the store. Loads the entire database
# if +reload+ is +true+
Expand Down
2 changes: 1 addition & 1 deletion spec/registry_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def saves_to_multidb
end

describe "#delete" do
pending "deletes the given object from store" do
it "deletes the given object from store" do
@store.put(:YARD, @foo)
expect(@store.get(:YARD)).to be @foo
expect(@store.paths_for_type(:method)).to eq ["YARD"]
Expand Down

0 comments on commit 3a4c122

Please sign in to comment.