-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path135_hangman_test_spec.rb
50 lines (41 loc) · 1.05 KB
/
135_hangman_test_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
# frozen_string_literal: true
require 'rspec'
require_relative './modules/classes/57_game'
describe 'Hangman with exceptions' do
it 'should be runing' do
game = Game.new('загадка')
expect(game.status).to eq :in_progress
end
it 'should returning win status' do
game = Game.new('загадка')
game.next_step 'з'
game.next_step 'а'
game.next_step 'г'
game.next_step 'а'
game.next_step 'д'
game.next_step 'к'
game.next_step 'а'
expect(game.status).to eq 1
expect(game.errors).to eq 0
end
it 'should returning lose status' do
game = Game.new('загадка')
game.next_step 'м'
game.next_step 'а'
game.next_step 'ц'
game.next_step 'у'
game.next_step 'м'
game.next_step 'о'
game.next_step 'т'
game.next_step 'о'
game.next_step 'ю'
game.next_step 'к'
game.next_step 'и'
game.next_step 'х'
game.next_step 'и'
game.next_step 'р'
game.next_step 'о'
expect(game.status).to eq(-1)
expect(game.errors).to eq 7
end
end