Adds tests for DODB::Index(V)#update(String, V).

remotes/1708105384931250775/master
Luka Vandervelden 2020-01-30 03:23:02 +01:00
parent 364887bde3
commit eb50b5c433
1 changed files with 20 additions and 0 deletions

View File

@ -260,6 +260,26 @@ describe "DODB::DataBase" do
db_ships_by_name.get?(some_new_ship.name).should eq(some_new_ship) db_ships_by_name.get?(some_new_ship.name).should eq(some_new_ship)
end end
it "properly updates" do
db = DODB::SpecDataBase.new
db_ships_by_name = db.new_index "name", &.name
Ship.all_ships.each do |ship|
db << ship
end
new_kisaragi = Ship.kisaragi.clone.tap do |s|
s.name = "Kisaragi Kai" # Dont think about it too much.
end
# Were changing an indexed value on purpose.
db_ships_by_name.update "Kisaragi", new_kisaragi
db_ships_by_name.get?("Kisaragi").should be_nil
db_ships_by_name.get?(new_kisaragi.name).should eq new_kisaragi
end
end end
describe "partitions" do describe "partitions" do