Class: TC_Deck

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



7
8
9
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb', line 7

def setup
  @deck = Deck.new
end

#test_contentObject



11
12
13
14
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb', line 11

def test_content
  expected = (1..52).to_a + [ "A", "B" ]
  assert_equal expected, @deck.to_a
end

#test_letterObject



22
23
24
25
26
27
28
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb', line 22

def test_letter
  expected = %w{ D W J nil X H Y R F D G }
  expected.each do |expected_letter|
    @deck.cipher_shuffle!
    assert_equal expected_letter, @deck.cipher_letter || "nil"
  end
end

#test_shuffleObject



16
17
18
19
20
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb', line 16

def test_shuffle
  @deck.cipher_shuffle!
  expected = (2..52).to_a + [ "A", "B", 1 ]
  assert_equal expected, @deck.to_a
end