-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoker_spec.rb
54 lines (48 loc) · 1.11 KB
/
poker_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
require "./poker"
describe Poker do
shared_context "one_pair" do
it { should be_one_pair(hand) }
end
shared_context "not one_pair" do
it { should_not be_one_pair(hand) }
end
subject { Poker }
describe ".one_pair?" do
context "given spade:1, diamond:1, heart:2, club:3, spade:4" do
let(:hand) {
[
Card.new(:s, 1),
Card.new(:d, 1),
Card.new(:h, 2),
Card.new(:c, 3),
Card.new(:s, 4),
]
}
it_behaves_like "one_pair"
end
context "given spade:1, diamond:5, heart:2, club:3, spade:4" do
let(:hand) {
[
Card.new(:s, 1),
Card.new(:d, 5),
Card.new(:h, 2),
Card.new(:c, 3),
Card.new(:s, 4),
]
}
it_behaves_like "not one_pair"
end
context "given spade:1, diamond:1, heart:1, club:3, spade:4" do
let(:hand) {
[
Card.new(:s, 1),
Card.new(:d, 1),
Card.new(:h, 1),
Card.new(:c, 3),
Card.new(:s, 4),
]
}
it_behaves_like "not one_pair"
end
end
end