diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fln_bot_rules_spec.rb | 42 | ||||
-rw-r--r-- | spec/mock_board.rb | 4 |
2 files changed, 46 insertions, 0 deletions
diff --git a/spec/fln_bot_rules_spec.rb b/spec/fln_bot_rules_spec.rb index 9e200f4..1e2fc27 100644 --- a/spec/fln_bot_rules_spec.rb +++ b/spec/fln_bot_rules_spec.rb @@ -411,6 +411,48 @@ describe ColonialTwilight::FLNBotRules do c = Sector.new(fln_active: 1, fln_underground: 1, gov_cubes: 1) expect(@rules.rally_8_priority([a, b, c])[0]).to be b end + + it 'may_rally_9_in? no control and no base' do + a = Sector.new(terror: 2) + expect(@rules.may_rally_9_in?(a)).to be false + end + + it 'may_rally_9_in? has control but no terror and oppose' do + a = Sector.new(fln_active: 1, oppose: true) + expect(@rules.may_rally_9_in?(a)).to be false + end + + it 'may_rally_9_in? has base but no terror and oppose' do + a = Sector.new(fln_bases: 1, gov_cubes: 1, oppose: true) + expect(@rules.may_rally_9_in?(a)).to be false + end + + it 'may_rally_9_in? has control and terror' do + a = Sector.new(fln_active: 1, terror: 1) + expect(@rules.may_rally_9_in?(a)).to be true + end + + it 'may_rally_9_in? has base and terror' do + a = Sector.new(fln_bases: 1, gov_cubes: 1, terror: 1) + expect(@rules.may_rally_9_in?(a)).to be true + end + + it 'may_rally_9_in? has control and not oppose' do + a = Sector.new(fln_active: 1, terror: 1) + expect(@rules.may_rally_9_in?(a)).to be true + end + + it 'may_rally_9_in? has base and not oppose' do + a = Sector.new(fln_bases: 1, gov_cubes: 1, terror: 1) + expect(@rules.may_rally_9_in?(a)).to be true + end + + it 'rally_9_priority no cubes' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 1, neutral: true) + c = Sector.new(terror: 2, neutral: true) + expect(@rules.rally_9_priority([a, b, c], 2)[0]).to be b + end end describe 'Extort' do diff --git a/spec/mock_board.rb b/spec/mock_board.rb index e1db1b3..2ea3899 100644 --- a/spec/mock_board.rb +++ b/spec/mock_board.rb @@ -37,6 +37,10 @@ class Sector @data[:oppose] || false end + def neutral? + @data[:neutral] || false + end + def terror @data[:terror] || 0 end |