summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-10-26 21:15:40 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2023-10-26 21:15:40 +0200
commit14cc1f5de9ad44887a913b3638a9403c661f11a7 (patch)
tree4a036d37c6a5c7ace0d866e19163b0651c810e2e /spec
parent910edf82f054fc1bde452b57d428980fe316f42a (diff)
downloadcolonial-twilight-14cc1f5de9ad44887a913b3638a9403c661f11a7.zip
colonial-twilight-14cc1f5de9ad44887a913b3638a9403c661f11a7.tar.gz
FLNBotRules : fix and spec dbg(msg, ret)
Diffstat (limited to 'spec')
-rw-r--r--spec/fln_bot_rules_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/fln_bot_rules_spec.rb b/spec/fln_bot_rules_spec.rb
index 1881f39..c21d339 100644
--- a/spec/fln_bot_rules_spec.rb
+++ b/spec/fln_bot_rules_spec.rb
@@ -6,10 +6,10 @@ require './spec/mock_board'
class FLNRulesImpl
include ColonialTwilight::FLNBotRules
attr_reader :board
- attr_writer :limited_op_only, :first_eligible, :will_be_next_first_eligible
+ attr_writer :debug, :limited_op_only, :first_eligible, :will_be_next_first_eligible
def initialize
- @debug = 666
+ @debug = 0
@board = Board.new
@limited_op_only = true
@first_eligible = true
@@ -44,6 +44,18 @@ describe ColonialTwilight::FLNBotRules do
@board = @rules.board
end
+ describe 'Debug' do
+ it 'level 1' do
+ @rules.debug = 1
+ expect { @rules.dbg('msg', true) }.to output(" msg : YES\n").to_stdout
+ end
+
+ it 'level 2' do
+ @rules.debug = 2
+ expect { @rules.dbg('msg', false) }.to output(" msg : NO\n").to_stdout
+ end
+ end
+
describe 'Pass' do
it 'pass? no resources' do
expect(@rules.pass?).to be true