From fcb4a526a76e0e8464fc42a92145fe0ed149026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 21 Sep 2023 17:04:03 +0200 Subject: Deck : add Card::capability? && specs --- lib/colonial_twilight/deck.rb | 4 ++++ spec/cards_spec.rb | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/colonial_twilight/deck.rb b/lib/colonial_twilight/deck.rb index 747cb2f..8c58bf2 100644 --- a/lib/colonial_twilight/deck.rb +++ b/lib/colonial_twilight/deck.rb @@ -40,6 +40,10 @@ module ColonialTwilight (@attributes & FLN_SPECIAL) == FLN_SPECIAL end + def capability? + fln_capability? || gov_capability? || dual_capability? + end + def fln_capability? (@attributes & FLN_CAPABILITY) == FLN_CAPABILITY end diff --git a/spec/cards_spec.rb b/spec/cards_spec.rb index 12ffb24..10efaee 100644 --- a/spec/cards_spec.rb +++ b/spec/cards_spec.rb @@ -43,6 +43,14 @@ describe ColonialTwilight::Card do end end + describe 'any capability' do + deck = ColonialTwilight::Deck.new + s = [13, 17, 18, 27, 32, 33, 35] + 1.upto(71) do |n| + it "is flags right #{n}" do expect(deck.pull(n).capability?).to be s.include?(n) end + end + end + describe 'FLN momentum' do deck = ColonialTwilight::Deck.new s = [2, 8, 10, 29, 40, 45] -- cgit v1.1-2-g2b99