Compare commits
4 commits
09e5a39b4c
...
d8ff99475e
| Author | SHA1 | Date | |
|---|---|---|---|
| d8ff99475e | |||
| 9726ecb1a5 | |||
| 540ce08caa | |||
| 881e63cfbd |
6 changed files with 20 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
yarn lint --max-warnings=0 --fix
|
||||
yarn lint --max-warnings=0 --fix && bin/rails test
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class Item < ApplicationRecord
|
|||
has_many :dyeworks_variants, class_name: "Item",
|
||||
inverse_of: :dyeworks_base_item
|
||||
|
||||
validates_presence_of :name, :description, :thumbnail_url, :rarity, :price,
|
||||
:zones_restrict
|
||||
|
||||
attr_writer :current_body_id, :owned, :wanted
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class Item
|
|||
)\z
|
||||
}x
|
||||
def inferred_dyeworks_base_item
|
||||
name_match = name.match(DYEWORKS_NAME_PATTERN)
|
||||
name_match = (name || "").match(DYEWORKS_NAME_PATTERN)
|
||||
return nil if name_match.nil?
|
||||
|
||||
Item.find_by_name(name_match["base"])
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
namespace :pets do
|
||||
desc "Load a pet's viewer data"
|
||||
task :load, [:name] => [:environment] do |task, args|
|
||||
pp Neopets::CustomPets.fetch_viewer_data(args[:name])
|
||||
viewer_data = Neopets::CustomPets.fetch_viewer_data(args[:name])
|
||||
puts JSON.pretty_generate(viewer_data)
|
||||
end
|
||||
|
||||
desc "Find pets that were, last we saw, of the given color and species"
|
||||
|
|
|
|||
14
test/fixtures/items.yml
vendored
Normal file
14
test/fixtures/items.yml
vendored
Normal file
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue