Add assets to modeling tests, and also uhh some other fixes
I forget, there was some tricky debugging about getting the fixtures right, I think the previous commit doesn't *actually* pass from a clean setting. Ah well, looks good now!
This commit is contained in:
parent
e92e315743
commit
5b1d1f0695
5 changed files with 318 additions and 2 deletions
282
spec/fixtures/zones.yml
vendored
Normal file
282
spec/fixtures/zones.yml
vendored
Normal file
|
@ -0,0 +1,282 @@
|
||||||
|
music:
|
||||||
|
id: 1
|
||||||
|
depth: 1
|
||||||
|
type_id: 4
|
||||||
|
label: Music
|
||||||
|
plain_label: music
|
||||||
|
soundeffects:
|
||||||
|
id: 2
|
||||||
|
depth: 2
|
||||||
|
type_id: 4
|
||||||
|
label: Sound Effects
|
||||||
|
plain_label: soundeffects
|
||||||
|
background:
|
||||||
|
id: 3
|
||||||
|
depth: 3
|
||||||
|
type_id: 3
|
||||||
|
label: Background
|
||||||
|
plain_label: background
|
||||||
|
biologyeffects:
|
||||||
|
id: 4
|
||||||
|
depth: 6
|
||||||
|
type_id: 1
|
||||||
|
label: Biology Effects
|
||||||
|
plain_label: biologyeffects
|
||||||
|
hindbiology:
|
||||||
|
id: 5
|
||||||
|
depth: 7
|
||||||
|
type_id: 1
|
||||||
|
label: Hind Biology
|
||||||
|
plain_label: hindbiology
|
||||||
|
markings:
|
||||||
|
id: 31
|
||||||
|
depth: 35
|
||||||
|
type_id: 2
|
||||||
|
label: Markings
|
||||||
|
plain_label: markings
|
||||||
|
hinddisease:
|
||||||
|
id: 7
|
||||||
|
depth: 9
|
||||||
|
type_id: 1
|
||||||
|
label: Hind Disease
|
||||||
|
plain_label: hinddisease
|
||||||
|
hindcover:
|
||||||
|
id: 8
|
||||||
|
depth: 10
|
||||||
|
type_id: 2
|
||||||
|
label: Hind Cover
|
||||||
|
plain_label: hindcover
|
||||||
|
hindtransientbiology:
|
||||||
|
id: 9
|
||||||
|
depth: 11
|
||||||
|
type_id: 1
|
||||||
|
label: Hind Transient Biology
|
||||||
|
plain_label: hindtransientbiology
|
||||||
|
hinddrippings:
|
||||||
|
id: 10
|
||||||
|
depth: 12
|
||||||
|
type_id: 1
|
||||||
|
label: Hind Drippings
|
||||||
|
plain_label: hinddrippings
|
||||||
|
backpack:
|
||||||
|
id: 11
|
||||||
|
depth: 13
|
||||||
|
type_id: 2
|
||||||
|
label: Backpack
|
||||||
|
plain_label: backpack
|
||||||
|
wingstransientbiology:
|
||||||
|
id: 12
|
||||||
|
depth: 14
|
||||||
|
type_id: 1
|
||||||
|
label: Wings Transient Biology
|
||||||
|
plain_label: wingstransientbiology
|
||||||
|
wings:
|
||||||
|
id: 13
|
||||||
|
depth: 15
|
||||||
|
type_id: 2
|
||||||
|
label: Wings
|
||||||
|
plain_label: wings
|
||||||
|
hairback:
|
||||||
|
id: 14
|
||||||
|
depth: 17
|
||||||
|
type_id: 1
|
||||||
|
label: Hair Back
|
||||||
|
plain_label: hairback
|
||||||
|
body:
|
||||||
|
id: 15
|
||||||
|
depth: 18
|
||||||
|
type_id: 1
|
||||||
|
label: Body
|
||||||
|
plain_label: body
|
||||||
|
bodydisease:
|
||||||
|
id: 17
|
||||||
|
depth: 20
|
||||||
|
type_id: 1
|
||||||
|
label: Body Disease
|
||||||
|
plain_label: bodydisease
|
||||||
|
feettransientbiology:
|
||||||
|
id: 18
|
||||||
|
depth: 21
|
||||||
|
type_id: 1
|
||||||
|
label: Feet Transient Biology
|
||||||
|
plain_label: feettransientbiology
|
||||||
|
shoes:
|
||||||
|
id: 19
|
||||||
|
depth: 22
|
||||||
|
type_id: 2
|
||||||
|
label: Shoes
|
||||||
|
plain_label: shoes
|
||||||
|
lowerbodytransientbiology:
|
||||||
|
id: 20
|
||||||
|
depth: 23
|
||||||
|
type_id: 1
|
||||||
|
label: Lower-body Transient Biology
|
||||||
|
plain_label: lowerbodytransientbiology
|
||||||
|
trousers:
|
||||||
|
id: 21
|
||||||
|
depth: 24
|
||||||
|
type_id: 2
|
||||||
|
label: Trousers
|
||||||
|
plain_label: trousers
|
||||||
|
upperbodytransientbiology:
|
||||||
|
id: 22
|
||||||
|
depth: 25
|
||||||
|
type_id: 1
|
||||||
|
label: Upper-body Transient Biology
|
||||||
|
plain_label: upperbodytransientbiology
|
||||||
|
shirtdress:
|
||||||
|
id: 23
|
||||||
|
depth: 26
|
||||||
|
type_id: 2
|
||||||
|
label: Shirt/Dress
|
||||||
|
plain_label: shirtdress
|
||||||
|
necklace:
|
||||||
|
id: 24
|
||||||
|
depth: 28
|
||||||
|
type_id: 2
|
||||||
|
label: Necklace
|
||||||
|
plain_label: necklace
|
||||||
|
gloves:
|
||||||
|
id: 25
|
||||||
|
depth: 29
|
||||||
|
type_id: 2
|
||||||
|
label: Gloves
|
||||||
|
plain_label: gloves
|
||||||
|
jacket:
|
||||||
|
id: 26
|
||||||
|
depth: 30
|
||||||
|
type_id: 2
|
||||||
|
label: Jacket
|
||||||
|
plain_label: jacket
|
||||||
|
collar:
|
||||||
|
id: 27
|
||||||
|
depth: 31
|
||||||
|
type_id: 2
|
||||||
|
label: Collar
|
||||||
|
plain_label: collar
|
||||||
|
bodydrippings:
|
||||||
|
id: 28
|
||||||
|
depth: 32
|
||||||
|
type_id: 1
|
||||||
|
label: Body Drippings
|
||||||
|
plain_label: bodydrippings
|
||||||
|
ruff:
|
||||||
|
id: 29
|
||||||
|
depth: 33
|
||||||
|
type_id: 1
|
||||||
|
label: Ruff
|
||||||
|
plain_label: ruff
|
||||||
|
head:
|
||||||
|
id: 30
|
||||||
|
depth: 34
|
||||||
|
type_id: 1
|
||||||
|
label: Head
|
||||||
|
plain_label: head
|
||||||
|
headdisease:
|
||||||
|
id: 32
|
||||||
|
depth: 36
|
||||||
|
type_id: 1
|
||||||
|
label: Head Disease
|
||||||
|
plain_label: headdisease
|
||||||
|
eyes:
|
||||||
|
id: 33
|
||||||
|
depth: 37
|
||||||
|
type_id: 1
|
||||||
|
label: Eyes
|
||||||
|
plain_label: eyes
|
||||||
|
mouth:
|
||||||
|
id: 34
|
||||||
|
depth: 38
|
||||||
|
type_id: 1
|
||||||
|
label: Mouth
|
||||||
|
plain_label: mouth
|
||||||
|
glasses:
|
||||||
|
id: 35
|
||||||
|
depth: 41
|
||||||
|
type_id: 2
|
||||||
|
label: Glasses
|
||||||
|
plain_label: glasses
|
||||||
|
earrings:
|
||||||
|
id: 41
|
||||||
|
depth: 45
|
||||||
|
type_id: 2
|
||||||
|
label: Earrings
|
||||||
|
plain_label: earrings
|
||||||
|
hairfront:
|
||||||
|
id: 37
|
||||||
|
depth: 40
|
||||||
|
type_id: 1
|
||||||
|
label: Hair Front
|
||||||
|
plain_label: hairfront
|
||||||
|
headtransientbiology:
|
||||||
|
id: 38
|
||||||
|
depth: 42
|
||||||
|
type_id: 1
|
||||||
|
label: Head Transient Biology
|
||||||
|
plain_label: headtransientbiology
|
||||||
|
headdrippings:
|
||||||
|
id: 39
|
||||||
|
depth: 43
|
||||||
|
type_id: 1
|
||||||
|
label: Head Drippings
|
||||||
|
plain_label: headdrippings
|
||||||
|
hat:
|
||||||
|
id: 50
|
||||||
|
depth: 16
|
||||||
|
type_id: 2
|
||||||
|
label: Hat
|
||||||
|
plain_label: hat
|
||||||
|
righthanditem:
|
||||||
|
id: 49
|
||||||
|
depth: 5
|
||||||
|
type_id: 2
|
||||||
|
label: Right-hand Item
|
||||||
|
plain_label: righthanditem
|
||||||
|
lefthanditem:
|
||||||
|
id: 43
|
||||||
|
depth: 47
|
||||||
|
type_id: 2
|
||||||
|
label: Left-hand Item
|
||||||
|
plain_label: lefthanditem
|
||||||
|
higherforegrounditem:
|
||||||
|
id: 44
|
||||||
|
depth: 49
|
||||||
|
type_id: 3
|
||||||
|
label: Higher Foreground Item
|
||||||
|
plain_label: higherforegrounditem
|
||||||
|
lowerforegrounditem:
|
||||||
|
id: 45
|
||||||
|
depth: 50
|
||||||
|
type_id: 3
|
||||||
|
label: Lower Foreground Item
|
||||||
|
plain_label: lowerforegrounditem
|
||||||
|
static:
|
||||||
|
id: 46
|
||||||
|
depth: 48
|
||||||
|
type_id: 2
|
||||||
|
label: Static
|
||||||
|
plain_label: static
|
||||||
|
thoughtbubble:
|
||||||
|
id: 47
|
||||||
|
depth: 51
|
||||||
|
type_id: 3
|
||||||
|
label: Thought Bubble
|
||||||
|
plain_label: thoughtbubble
|
||||||
|
backgrounditem:
|
||||||
|
id: 48
|
||||||
|
depth: 4
|
||||||
|
type_id: 3
|
||||||
|
label: Background Item
|
||||||
|
plain_label: backgrounditem
|
||||||
|
belt:
|
||||||
|
id: 51
|
||||||
|
depth: 27
|
||||||
|
type_id: 2
|
||||||
|
label: Belt
|
||||||
|
plain_label: belt
|
||||||
|
foreground:
|
||||||
|
id: 52
|
||||||
|
depth: 52
|
||||||
|
type_id: 3
|
||||||
|
label: Foreground
|
||||||
|
plain_label: foreground
|
|
@ -11,6 +11,6 @@ module Neopets::CustomPets
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fetch_image_hash(pet_name, ...)
|
def self.fetch_image_hash(pet_name, ...)
|
||||||
"mock-image-hash:#{pet_name}"
|
"m:#{pet_name}"[0, 8] # A mock hash, like `m:thyass` for "thyassa".
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,8 @@ require 'rails_helper'
|
||||||
require_relative '../mocks/custom_pets'
|
require_relative '../mocks/custom_pets'
|
||||||
|
|
||||||
RSpec.describe Pet, type: :model do
|
RSpec.describe Pet, type: :model do
|
||||||
|
fixtures :colors, :species, :zones
|
||||||
|
|
||||||
context "#load" do
|
context "#load" do
|
||||||
context "for thyassa, the Purple Chia" do
|
context "for thyassa, the Purple Chia" do
|
||||||
subject { Pet.load "thyassa" }
|
subject { Pet.load "thyassa" }
|
||||||
|
@ -15,7 +17,7 @@ RSpec.describe Pet, type: :model do
|
||||||
expect(subject.pet_type.color).to eq Color.find_by_name!("purple")
|
expect(subject.pet_type.color).to eq Color.find_by_name!("purple")
|
||||||
expect(subject.pet_type.species).to eq Species.find_by_name!("chia")
|
expect(subject.pet_type.species).to eq Species.find_by_name!("chia")
|
||||||
expect(subject.pet_type.body_id).to eq 212
|
expect(subject.pet_type.body_id).to eq 212
|
||||||
expect(subject.pet_type.image_hash).to eq "mock-image-hash:thyassa"
|
expect(subject.pet_type.image_hash).to eq "m:thyass"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has a new unlabeled Purple Chia pet state" do
|
it "has a new unlabeled Purple Chia pet state" do
|
||||||
|
@ -24,6 +26,38 @@ RSpec.describe Pet, type: :model do
|
||||||
expect(subject.pet_state.species).to eq Species.find_by_name!("chia")
|
expect(subject.pet_state.species).to eq Species.find_by_name!("chia")
|
||||||
expect(subject.pet_state.pose).to eq "UNKNOWN"
|
expect(subject.pet_state.pose).to eq "UNKNOWN"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "has new assets for the biology layers" do
|
||||||
|
subject.save! # TODO: I wish this were set up before saving.
|
||||||
|
|
||||||
|
s = subject.pet_state.swf_assets.sort_by(&:id)
|
||||||
|
|
||||||
|
expect(s.size).to eq 4
|
||||||
|
expect(s[0].type).to eq "biology"
|
||||||
|
expect(s[0].remote_id).to eq 10083
|
||||||
|
expect(s[0].zone_id).to eq 37
|
||||||
|
expect(s[0].url).to eq "https://images.neopets.com/cp/bio/swf/000/000/010/10083_8a1111a13f.swf"
|
||||||
|
expect(s[0].manifest_url).to eq "https://images.neopets.com/cp/bio/data/000/000/010/10083_8a1111a13f/manifest.json"
|
||||||
|
expect(s[0].zones_restrict).to eq "0000000000000000000000000000000000000000000000000000"
|
||||||
|
expect(s[1].type).to eq "biology"
|
||||||
|
expect(s[1].remote_id).to eq 11613
|
||||||
|
expect(s[1].zone_id).to eq 15
|
||||||
|
expect(s[1].url).to eq "https://images.neopets.com/cp/bio/swf/000/000/011/11613_f7d8d377ab.swf"
|
||||||
|
expect(s[1].manifest_url).to eq "https://images.neopets.com/cp/bio/data/000/000/011/11613_f7d8d377ab/manifest.json"
|
||||||
|
expect(s[1].zones_restrict).to eq "0000000000000000000000000000000000000000000000000000"
|
||||||
|
expect(s[2].type).to eq "biology"
|
||||||
|
expect(s[2].remote_id).to eq 14187
|
||||||
|
expect(s[2].zone_id).to eq 34
|
||||||
|
expect(s[2].url).to eq "https://images.neopets.com/cp/bio/swf/000/000/014/14187_0e65c2082f.swf"
|
||||||
|
expect(s[2].manifest_url).to eq "https://images.neopets.com/cp/bio/data/000/000/014/14187_0e65c2082f/manifest.json"
|
||||||
|
expect(s[2].zones_restrict).to eq "0000000000000000000000000000000000000000000000000000"
|
||||||
|
expect(s[3].type).to eq "biology"
|
||||||
|
expect(s[3].remote_id).to eq 14189
|
||||||
|
expect(s[3].zone_id).to eq 33
|
||||||
|
expect(s[3].url).to eq "https://images.neopets.com/cp/bio/swf/000/000/014/14189_102e4991e9.swf"
|
||||||
|
expect(s[3].manifest_url).to eq "https://images.neopets.com/cp/bio/data/000/000/014/14189_102e4991e9/manifest.json"
|
||||||
|
expect(s[3].zones_restrict).to eq "0000000000000000000000000000000000000000000000000000"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue