-
Notifications
You must be signed in to change notification settings - Fork 0
/
card_spec.rb
64 lines (63 loc) · 1.63 KB
/
card_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require './card.rb'
describe Card do
before(:each) do
@naipe = double()
end
it 'carta eh valida' do
card = Card.new 5, @naipe
card.valid?.should == true
end
it 'carta eh invalida quando menor que 1' do
card = Card.new 0, @naipe
card.valid?.should == false
end
it 'carta eh invalida quando maior do que 13' do
card = Card.new 14, @naipe
card.valid?.should == false
end
it 'valor da carta' do
value = double()
card = Card.new value, @naipe
card.value.should == value
end
it 'nome das cartas' do
card = Card.new 1, @naipe
card.name.should == "as"
card = Card.new 2, @naipe
card.name.should == "2"
card = Card.new 7, @naipe
card.name.should == "7"
card = Card.new 10, @naipe
card.name.should == "10"
card = Card.new 11, @naipe
card.name.should == "valete"
card = Card.new 12, @naipe
card.name.should == "dama"
card = Card.new 13, @naipe
card.name.should == "rei"
end
it 'Verificar se uma carta eh menor do que outra' do
card = Card.new 1, @naipe
card2 = Card.new 2, @naipe
card.<(card2).should == true
end
it 'Verficar se uma carta nao eh menor do que outra' do
card = Card.new 2, @naipe
card2 = Card.new 1, @naipe
card.<(card2).should == false
end
it 'Valor das cartas para escopa de 15' do
card = Card.new 1, @naipe
card.value_for_escopa.should == 1
card = Card.new 2, @naipe
card.value_for_escopa.should == 2
card = Card.new 7, @naipe
card.value_for_escopa.should == 7
card = Card.new 11, @naipe
card.value_for_escopa.should == 8
card = Card.new 12, @naipe
card.value_for_escopa.should == 9
card = Card.new 13, @naipe
card.value_for_escopa.should == 10
end
end