Compare commits
No commits in common. "d8ff99475e9ad84e39fc53868ff87b5b97e8dcb3" and "09e5a39b4cd84623bbc1477d23b2956b8767a512" have entirely different histories.
d8ff99475e
...
09e5a39b4c
6 changed files with 9 additions and 20 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
yarn lint --max-warnings=0 --fix && bin/rails test
|
yarn lint --max-warnings=0 --fix
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ class Item < ApplicationRecord
|
||||||
has_many :dyeworks_variants, class_name: "Item",
|
has_many :dyeworks_variants, class_name: "Item",
|
||||||
inverse_of: :dyeworks_base_item
|
inverse_of: :dyeworks_base_item
|
||||||
|
|
||||||
validates_presence_of :name, :description, :thumbnail_url, :rarity, :price,
|
|
||||||
:zones_restrict
|
|
||||||
|
|
||||||
attr_writer :current_body_id, :owned, :wanted
|
attr_writer :current_body_id, :owned, :wanted
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class Item
|
||||||
)\z
|
)\z
|
||||||
}x
|
}x
|
||||||
def inferred_dyeworks_base_item
|
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?
|
return nil if name_match.nil?
|
||||||
|
|
||||||
Item.find_by_name(name_match["base"])
|
Item.find_by_name(name_match["base"])
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
namespace :pets do
|
namespace :pets do
|
||||||
desc "Load a pet's viewer data"
|
desc "Load a pet's viewer data"
|
||||||
task :load, [:name] => [:environment] do |task, args|
|
task :load, [:name] => [:environment] do |task, args|
|
||||||
viewer_data = Neopets::CustomPets.fetch_viewer_data(args[:name])
|
pp Neopets::CustomPets.fetch_viewer_data(args[:name])
|
||||||
puts JSON.pretty_generate(viewer_data)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Find pets that were, last we saw, of the given color and species"
|
desc "Find pets that were, last we saw, of the given color and species"
|
||||||
|
|
|
||||||
14
test/fixtures/items.yml
vendored
14
test/fixtures/items.yml
vendored
|
|
@ -1,14 +0,0 @@
|
||||||
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,6 +203,12 @@ class TradeActivityTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
freeze_time # to compare timestamps accurately
|
freeze_time # to compare timestamps accurately
|
||||||
|
|
||||||
|
Item.create!(
|
||||||
|
thumbnail_url: "https://images.neopets.com/foo.png",
|
||||||
|
zones_restrict: "",
|
||||||
|
price: 123,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue