hearthstone 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,157 +0,0 @@
1
- require_relative "../../../lib/hearthstone/models"
2
-
3
- describe Hearthstone::Models::Game do
4
- let(:game) { Hearthstone::Models::Game.new }
5
-
6
- context "#add_player" do
7
- it "adds players into game" do
8
- game.add_player(id: 2, name: "siuying", first_player: true, hero_id: 36, hero_card_id: "HERO_05", hero_power_id: 37, hero_power_card_id: "DS1h_292")
9
- game.add_player(id: 1, name: "화이트베리", first_player: false, hero_id: 4, hero_card_id: "HERO_04", hero_power_id: 5, hero_power_card_id: "CS2_101")
10
-
11
- player1 = game.player_with_id(1)
12
- expect(player1.name).to eq("화이트베리")
13
-
14
- player2 = game.player_with_id(2)
15
- expect(player2.name).to eq("siuying")
16
- end
17
- end
18
-
19
- context "#open_card" do
20
- it "adds card into game" do
21
- game.open_card(id: 5, card_id: "CS2_101")
22
-
23
- entity = game.entity_with_id(5)
24
- expect(entity.card).to_not be_nil
25
- expect(entity.card.name).to eq("Reinforce")
26
- end
27
- end
28
-
29
- context "#card_revealed" do
30
- it "shows card from game" do
31
- game.open_card(id: 34, card_id: "")
32
- entity = game.entity_with_id(34)
33
- expect(entity.card).to be_nil
34
-
35
- game.card_revealed(id: 34, card_id: "FP1_020")
36
- entity = game.entity_with_id(34)
37
- expect(entity.card).to_not be_nil
38
- expect(entity.card.name).to eq("Avenge")
39
- end
40
- end
41
-
42
- context "Game Started" do
43
- before(:each) do
44
- game.add_player(id: 2, name: "siuying", first_player: true, hero_id: 36, hero_card_id: "HERO_05", hero_power_id: 37, hero_power_card_id: "DS1h_292")
45
- game.add_player(id: 1, name: "화이트베리", first_player: false, hero_id: 4, hero_card_id: "HERO_04", hero_power_id: 5, hero_power_card_id: "CS2_101")
46
- end
47
-
48
- context "#card_added_to_deck" do
49
- it "adds card into player deck" do
50
- game.card_added_to_deck(player_id: 1, id: 7, card_id: "")
51
-
52
- entity = game.entity_with_id(7)
53
- expect(entity).to_not be_nil
54
- expect(entity.card).to be_nil # not yet know the card
55
-
56
- player = game.player_with_id(1)
57
- expect(player).to_not be_nil
58
- expect(player.deck).to include(entity)
59
- end
60
- end
61
-
62
- context "#card_received" do
63
- it "adds card into player hand" do
64
- player = game.player_with_id(2)
65
-
66
- game.card_added_to_deck(player_id: 2, id: 58, card_id: "")
67
- expect(player).to_not be_nil
68
- expect(player.hand).to be_empty
69
- expect(player.deck).to_not be_empty
70
-
71
- game.card_received(player_id: 2, id: 58, card_id: "EX1_556")
72
-
73
- entity = game.entity_with_id(58)
74
- expect(entity).to_not be_nil
75
- expect(entity.card).to eq(game.card_with_card_id("EX1_556"))
76
- expect(player.hand).to include(entity)
77
- expect(player.deck).to be_empty
78
- end
79
- end
80
-
81
- context "#card_drawn" do
82
- it "adds card into player hands" do
83
- player = game.player_with_id(2)
84
-
85
- expect(player).to_not be_nil
86
- expect(player.hand).to be_empty
87
-
88
- game.card_drawn(player_id: 2, id: 58, card_id: "EX1_556")
89
- entity = game.entity_with_id(58)
90
- expect(entity).to_not be_nil
91
- expect(entity.card).to eq(game.card_with_card_id("EX1_556"))
92
- expect(player.hand).to include(entity)
93
- end
94
- end
95
-
96
- context "#card_attached" do
97
- it "adds effect to a card" do
98
- player = game.player_with_id(2)
99
- game.open_card(id: 69, card_id: "FP1_028e")
100
- game.open_card(id: 57, card_id: "FP1_028")
101
-
102
- target = game.entity_with_id(57)
103
- attachment = game.entity_with_id(69)
104
- game.card_attached(attachment_id: attachment.id, target_id: target.id)
105
-
106
- expect(target.attachments).to include(attachment)
107
- end
108
- end
109
-
110
- context "#apply_damage" do
111
- it "apply damage to a card" do
112
- player = game.player_with_id(2)
113
- game.open_card(id: 57, card_id: "FP1_028")
114
-
115
- target = game.entity_with_id(57)
116
- game.apply_damage(id: 57, amount: 2)
117
-
118
- expect(target.damaged).to eq(2)
119
- end
120
- end
121
-
122
- context "#card_played" do
123
- it "move cards in play" do
124
- player = game.player_with_id(2)
125
- game.open_card(id: 57, card_id: "FP1_028")
126
-
127
- target = game.entity_with_id(57)
128
- game.card_played(player_id: 2, id: 57, card_id: "FP1_028")
129
- expect(player.play).to include(target)
130
- end
131
- end
132
-
133
- context "#card_destroyed" do
134
- it "move cards to graveyard" do
135
- player = game.player_with_id(2)
136
- game.open_card(id: 57, card_id: "FP1_028")
137
-
138
- target = game.entity_with_id(57)
139
- game.card_destroyed(player_id: 2, id: 57)
140
- expect(player.graveyard).to include(target)
141
- end
142
- end
143
-
144
- context "#card_put_in_play" do
145
- it "put cards in play" do
146
- player = game.player_with_id(2)
147
-
148
- game.card_put_in_play(player_id: 2, id: 78, card_id: "GVG_103")
149
- target = game.entity_with_id(78)
150
- expect(target).to_not be_nil
151
- expect(target.card.id).to eq("GVG_103")
152
- expect(player.play).to include(target)
153
- end
154
- end
155
- end
156
-
157
- end