diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-12-04 14:37:27 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-12-04 14:37:27 +0100 |
commit | c4086c04aa81379a045e5c7b1c0efe09ff38bb75 (patch) | |
tree | d547961de60b621d9532538011ded85c78a955c7 /spec | |
parent | 420487be4001873a7168db25fc6a52f4fe6fabcd (diff) | |
download | colonial-twilight-c4086c04aa81379a045e5c7b1c0efe09ff38bb75.zip colonial-twilight-c4086c04aa81379a045e5c7b1c0efe09ff38bb75.tar.gz |
FLNBotRules : add is_rallied block to rally_9_priority
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fln_bot_rules_spec.rb | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/spec/fln_bot_rules_spec.rb b/spec/fln_bot_rules_spec.rb index 2d46f0b..dc071cb 100644 --- a/spec/fln_bot_rules_spec.rb +++ b/spec/fln_bot_rules_spec.rb @@ -450,25 +450,68 @@ describe ColonialTwilight::FLNBotRules do expect(@rules.may_rally_9_in?(a)).to be true end - it 'rally_9_priority support' do + it 'rally_9_priority support rallied' do a = Sector.new(terror: 1, oppose: true) b = Sector.new(terror: 3, support: true) c = Sector.new(terror: 2, support: true) - expect(@rules.rally_9_priority([a, b, c], 3)[0]).to be c + l = @rules.rally_9_priority([a, b, c], 3) { true } + expect(l[0]).to be c end - it 'rally_9_priority neutral' do + it 'rally_9_priority support not rallied' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 2, support: true) + c = Sector.new(terror: 1, support: true) + l = @rules.rally_9_priority([a, b, c], 3) { false } + expect(l[0]).to be c + end + + it 'rally_9_priority neutral rallied' do a = Sector.new(terror: 1, oppose: true) b = Sector.new(terror: 3, neutral: true) c = Sector.new(terror: 2, neutral: true) - expect(@rules.rally_9_priority([a, b, c], 3)[0]).to be c + l = @rules.rally_9_priority([a, b, c], 3) { true } + expect(l[0]).to be c + end + + it 'rally_9_priority neutral not rallied' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 2, neutral: true) + c = Sector.new(terror: 1, neutral: true) + l = @rules.rally_9_priority([a, b, c], 3) { false } + expect(l[0]).to be c + end + + it 'rally_9_priority infinite resources rallied' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 3, support: true) + c = Sector.new(terror: 2, support: true) + l = @rules.rally_9_priority([a, b, c], 0) { true } + expect(l.size).to eq 2 + end + + it 'rally_9_priority infinite resources not rallied' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 3, support: true) + c = Sector.new(terror: 2, support: true) + l = @rules.rally_9_priority([a, b, c], 0) { false } + expect(l.size).to eq 2 + end + + it 'rally_9_priority infinite resources rallied' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 3, support: true) + c = Sector.new(terror: 2, support: true) + l = @rules.rally_9_priority([a, b, c], 0) { true } + expect(l.size).to eq 2 end - it 'rally_9_priority infinite resources' do + it 'rally_9_priority infinite resources not rallied' do a = Sector.new(terror: 1, oppose: true) b = Sector.new(terror: 3, support: true) c = Sector.new(terror: 2, support: true) - expect(@rules.rally_9_priority([a, b, c], 0).size).to be 2 + l = @rules.rally_9_priority([a, b, c], 0) { false } + expect(l.size).to eq 2 end end |