From 9726ecb1a5ebab4736fcd7c7e718279bc05ff271 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Mon, 21 Oct 2024 14:26:36 -0700 Subject: [PATCH] Fix trade activity tests: use a valid item fixture, not a placeholder In 540ce08caa54827adfa964961c5e511e233b62b5, I updated the Item class to be more explicit about what fields are required, so this test would fail in a more helpful way, instead of just crashing from `name` being `nil` when trying to infer the Dyeworks info. Now, we update the test to use Rails's standard "fixture" system to set up a more-correct placeholder item, instead! --- test/fixtures/items.yml | 14 ++++++++++++++ test/trade_activity_test.rb | 6 ------ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 test/fixtures/items.yml diff --git a/test/fixtures/items.yml b/test/fixtures/items.yml new file mode 100644 index 00000000..f2d3e93c --- /dev/null +++ b/test/fixtures/items.yml @@ -0,0 +1,14 @@ +straw_hat: + id: 58 + name: Straw Hat + description: "This straw hat will keep the sun out of your pets eyes in + bright sunlight." + thumbnail_url: https://images.neopets.com/items/straw-hat.gif + type: Clothes + category: Clothes + rarity: Very Rare + rarity_index: 90 + price: 376 + weight_lbs: 1 + zones_restrict: 0000000000000000000000000001000000001010000000000000 + species_support_ids: "35" diff --git a/test/trade_activity_test.rb b/test/trade_activity_test.rb index 3ed06e96..6dfd2238 100644 --- a/test/trade_activity_test.rb +++ b/test/trade_activity_test.rb @@ -203,12 +203,6 @@ class TradeActivityTest < ActiveSupport::TestCase setup do freeze_time # to compare timestamps accurately - - Item.create!( - thumbnail_url: "https://images.neopets.com/foo.png", - zones_restrict: "", - price: 123, - ) end private