diff --git a/app/models/item.rb b/app/models/item.rb index 8be75718..4b7a4feb 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -291,6 +291,10 @@ class Item < ApplicationRecord # This might just be a species-specific item. Let's be conservative in # our prediction, though we'll revise it if we see another body ID. compatible_body_ids + elsif compatible_body_ids.size == 0 + # If somehow we have this item, but not any modeling data for it (weird!), + # consider it to fit all standard pet types until shown otherwise. + PetType.basic.distinct.pluck(:body_id).sort else # First, find our compatible pet types, then pair each body ID with its # color. (As an optimization, we omit standard colors, other than the diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb index b8434aae..1b640742 100644 --- a/spec/models/item_spec.rb +++ b/spec/models/item_spec.rb @@ -29,11 +29,11 @@ RSpec.describe Item do describe "an item without any modeling data" do subject(:item) { items(:straw_hat) } - pending("is not fully modeled") { should_not be_predicted_fully_modeled } + it("is not fully modeled") { should_not be_predicted_fully_modeled } it("has no compatible body IDs") do expect(item.compatible_body_ids).to be_empty end - pending("predicts all standard bodies are compatible") do + it("predicts all standard bodies are compatible") do expect(item.predicted_missing_body_ids).to contain_exactly(1, 2, 3) end end