diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-26 10:44:21 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-26 10:44:21 +0200 |
commit | f8bbcdff828cf3cec7ae4529fbf8c7c8c7474da3 (patch) | |
tree | 099220f4a142769c18f6a9cf08af7422c5c70971 | |
parent | 41345b8cc52bdf1a01c30ab7b34bf7e3b901a853 (diff) | |
download | colonial-twilight-f8bbcdff828cf3cec7ae4529fbf8c7c8c7474da3.zip colonial-twilight-f8bbcdff828cf3cec7ae4529fbf8c7c8c7474da3.tar.gz |
improve Card specs
-rw-r--r-- | spec/cards_spec.rb | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/spec/cards_spec.rb b/spec/cards_spec.rb index 10efaee..da9d578 100644 --- a/spec/cards_spec.rb +++ b/spec/cards_spec.rb @@ -3,75 +3,77 @@ require './lib/colonial_twilight/deck' describe ColonialTwilight::Card do + before do + @deck = ColonialTwilight::Deck.new + end + + describe 'Pull' do + it 'raise exception' do + @deck.pull(1) + expect { @deck.pull(1) }.to raise_error(Exception) + end + end + describe 'Propaganda' do - deck = ColonialTwilight::Deck.new s = [67, 68, 69, 70, 71] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).propaganda?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).propaganda?).to be s.include?(n) end end end describe 'Single or Dual' do - deck = ColonialTwilight::Deck.new s = [4, 9, 14, 18, 20, 25, 28, 30, 52, 54, 56, 57, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).single?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).single?).to be s.include?(n) end end end describe 'FLN capability' do - deck = ColonialTwilight::Deck.new s = [17, 27, 32, 33] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).fln_capability?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).fln_capability?).to be s.include?(n) end end end describe 'GOV capability' do - deck = ColonialTwilight::Deck.new s = [13, 35] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).gov_capability?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).gov_capability?).to be s.include?(n) end end end describe 'DUAL capability' do - deck = ColonialTwilight::Deck.new s = [18] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).dual_capability?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).dual_capability?).to be s.include?(n) end 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 + 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] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).fln_momentum?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).fln_momentum?).to be s.include?(n) end end end describe 'GOV momentum' do - deck = ColonialTwilight::Deck.new s = [5, 11, 12, 31, 44, 45, 46, 53] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).gov_momentum?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).gov_momentum?).to be s.include?(n) end end end describe 'DUAL momentum' do - deck = ColonialTwilight::Deck.new s = [56, 57] 1.upto(71) do |n| - it "is flags right #{n}" do expect(deck.pull(n).dual_momentum?).to be s.include?(n) end + it "is flags right #{n}" do expect(@deck.pull(n).dual_momentum?).to be s.include?(n) end end end end |