From 74aff338ffb5a1b4dacf0b35c34ff1f5f87008f8 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Tue, 11 Feb 2020 19:45:54 +0100 Subject: [PATCH] Partition#delete test added --- spec/test.cr | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/test.cr b/spec/test.cr index 29d02b0..d432925 100644 --- a/spec/test.cr +++ b/spec/test.cr @@ -308,6 +308,24 @@ describe "DODB::DataBase" do }.should be_true end end + + it "removes select elements from partitions" do + db = DODB::SpecDataBase.new + + db_ships_by_class = db.new_partition "class", &.klass + + Ship.all_ships.each do |ship| + db << ship + end + + db_ships_by_class.delete "Mutsuki", &.name.==("Kisaragi") + + Ship.all_ships.map(&.klass).uniq.each do |klass| + partition = db_ships_by_class.get klass + + partition.any?(&.name.==("Kisaragi")).should be_false + end + end end describe "tags" do