spec/integration/yard/arstotzka_spec.rb in arstotzka-1.0.3 vs spec/integration/yard/arstotzka_spec.rb in arstotzka-1.0.4

- old
+ new

@@ -1,12 +1,12 @@ # frozen_string_literal: true require 'spec_helper' describe Arstotzka do - describe :yard do - subject { Collector.new(hash) } + describe 'yard' do + subject(:collector) { Collector.new(hash) } let(:hash) { JSON.parse json } let(:json) do <<-JSON { @@ -63,50 +63,50 @@ JSON end describe '#full_name' do it 'returns the full_name' do - expect(subject.full_name).to eq('Kelly Khan') + expect(collector.full_name).to eq('Kelly Khan') end it 'does not cache name' do expect do hash['person']['fullName'] = 'Robert' - end.to change(subject, :full_name).to('Robert') + end.to change(collector, :full_name).to('Robert') end end describe '#age' do it 'returns the age' do - expect(subject.age).to eq(32) + expect(collector.age).to eq(32) end end describe '#gender' do it 'returns person gender' do - expect(subject.gender).to eq(Collector::FEMALE) + expect(collector.gender).to eq(Collector::FEMALE) end it 'does caches gender' do expect do hash['person']['gender'] = 'man' - end.not_to change(subject, :gender) + end.not_to change(collector, :gender) end end describe '#car_names' do it 'returns the nick names of the cars' do - expect(subject.car_names).to eq(%w[Betty Roger Geronimo MissingName]) + expect(collector.car_names).to eq(%w[Betty Roger Geronimo MissingName]) end end describe '#finished_games' do it 'returns the finished games' do expected = [ Collector::Game.new(name: 'TheNextBigThing', played: 100.0), Collector::Game.new(name: 'Zelda', played: 90.0) ] - expect(subject.finished_games).to eq(expected) + expect(collector.finished_games).to eq(expected) end end end end