impress/spec/models/pet_spec.rb
Emi Matchu e92e315743 Move modeling tests to RSpec
Also note the jsbundling bump, that was so I can us the relatively-new
`SKIP_YARN_INSTALL=1` flag when running tests, to be a bit faster.
2024-10-21 16:03:58 -07:00

29 lines
1 KiB
Ruby

require 'rails_helper'
require_relative '../mocks/custom_pets'
RSpec.describe Pet, type: :model do
context "#load" do
context "for thyassa, the Purple Chia" do
subject { Pet.load "thyassa" }
it "is named thyassa" do
expect(subject.name).to eq("thyassa")
end
it "has a new Purple Chia pet type" do
expect(subject.pet_type.new_record?).to be true
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.body_id).to eq 212
expect(subject.pet_type.image_hash).to eq "mock-image-hash:thyassa"
end
it "has a new unlabeled Purple Chia pet state" do
expect(subject.pet_state.new_record?).to be true
expect(subject.pet_state.color).to eq Color.find_by_name!("purple")
expect(subject.pet_state.species).to eq Species.find_by_name!("chia")
expect(subject.pet_state.pose).to eq "UNKNOWN"
end
end
end
end