summaryrefslogtreecommitdiffstats
path: root/spec/fln_rules_spec.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-10-23 19:08:21 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2023-10-23 19:08:21 +0200
commit8b34966151c15a4fb022a6205c8143b90f38f625 (patch)
treeb222351dad7761c7364298044f246b062244730d /spec/fln_rules_spec.rb
parent6822431aa1d93a11a8ab266284783814747721f3 (diff)
downloadcolonial-twilight-8b34966151c15a4fb022a6205c8143b90f38f625.zip
colonial-twilight-8b34966151c15a4fb022a6205c8143b90f38f625.tar.gz
FLNRules : use mock Board and Sector
Diffstat (limited to 'spec/fln_rules_spec.rb')
-rw-r--r--spec/fln_rules_spec.rb37
1 files changed, 23 insertions, 14 deletions
diff --git a/spec/fln_rules_spec.rb b/spec/fln_rules_spec.rb
index fe8e301..1b55288 100644
--- a/spec/fln_rules_spec.rb
+++ b/spec/fln_rules_spec.rb
@@ -2,6 +2,7 @@
require './lib/colonial_twilight/fln_rules'
require './lib/colonial_twilight/board'
+require './spec/mock_board'
class FLNRulesImpl
include ColonialTwilight::FLNRules
@@ -25,31 +26,39 @@ describe ColonialTwilight::FLNRules do
expect(rules.rally_spaces(@board).size).to eq(27)
end
- it 'may_rally_in? not in city at support' do
- a = ColonialTwilight::City.new('a', 'w', 0, 0)
- a.shift :support
- expect(rules.may_rally_in?(a)).to be false
+ it 'may_rally_in? sector' do
+ a = Sector.new
+ expect(rules.may_rally_in?(a)).to be true
end
- it 'may_rally_in? not in not independent country' do
- a = ColonialTwilight::Country.new('country')
+ it 'may_rally_in? in city not at support' do
+ a = Sector.new({ name: 'city', support: false })
+ expect(rules.may_rally_in?(a)).to be true
+ end
+
+ it 'may_rally_in? not in city at support' do
+ a = Sector.new({ name: 'city', support: true })
expect(rules.may_rally_in?(a)).to be false
end
- it 'may_rally_in?' do
- a = ColonialTwilight::Sector.new('a', 'w', 0, 0)
+ it 'may_rally_in? in independent country' do
+ a = Sector.new({ name: 'country', independent: true })
expect(rules.may_rally_in?(a)).to be true
end
- it 'may place 1 FLN cube' do
- a = ColonialTwilight::Sector.new('a', 'w', 0, 0)
+ it 'may_rally_in? not in not independent country' do
+ a = Sector.new({ name: 'country', independent: false })
+ expect(rules.may_rally_in?(a)).to be false
+ end
+
+ it 'may place 1 guerrillas' do
+ a = Sector.new({ pop: 3 })
expect(rules.max_placable_guerrillas(a)).to eq(1)
end
- it 'may place 2 FLN cube' do
- a = ColonialTwilight::Sector.new('a', 'w', 0, 2)
- a.add :fln_base
- expect(rules.max_placable_guerrillas(a)).to eq(3)
+ it 'may place pop + base guerrillas' do
+ a = Sector.new({ pop: 3, fln_bases: 2 })
+ expect(rules.max_placable_guerrillas(a)).to eq(5)
end
end