summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/colonial_twilight/spaces.rb4
-rw-r--r--spec/spaces_spec.rb2
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)