From 44e9358965f31a6453fcb1cbaca6bcbb4756ba16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 8 Nov 2023 22:14:00 +0100 Subject: Spaces: fix #shift_terror --- lib/colonial_twilight/spaces.rb | 4 ++-- spec/spaces_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/colonial_twilight/spaces.rb b/lib/colonial_twilight/spaces.rb index 909e9db..6eaf3c7 100644 --- a/lib/colonial_twilight/spaces.rb +++ b/lib/colonial_twilight/spaces.rb @@ -147,9 +147,9 @@ module ColonialTwilight end def shift_terror(num = 1) - @terror += num + raise "terror cant be negative" if @terror.zero? and num.negative? - raise "terror cant be negative" if @terror.negative? + @terror += num end def resettled? diff --git a/spec/spaces_spec.rb b/spec/spaces_spec.rb index 0c7e6bc..d7af8e5 100644 --- a/spec/spaces_spec.rb +++ b/spec/spaces_spec.rb @@ -80,7 +80,7 @@ describe ColonialTwilight::Sector do it 'terror' do expect(@s.terror?).to be false expect(@s.terror).to eq 0 - @s.shift_terror 2 + expect(@s.shift_terror(2)).to eq 2 expect(@s.terror?).to be true expect(@s.terror).to eq 2 expect { @t.shift_terrort(-3) }.to raise_error(Exception) -- cgit v1.1-2-g2b99