Skip to content

Commit 4af163f

Browse files
committed
Add specs
1 parent 19d9749 commit 4af163f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

spec/ball_spec.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
RSpec.describe Ball do
55
let(:answers) { YAML.load_file(File.join(__dir__, '../answers.yml')) }
66

7-
it 'prints the answer' do
8-
expect(STDOUT).to receive(:puts)
9-
subject.shake
10-
end
11-
127
it { expect(answers).to include(subject.shake) }
8+
it { expect(answers).to eql(Ball::ANSWERS) }
9+
10+
describe '#shake' do
11+
before { stub_const('Ball::ANSWERS', ['ANSWER']) }
12+
13+
it 'prints colorized answer' do
14+
expect(STDOUT).to receive(:puts).with("\e[31mANSWER\e[0m")
15+
subject.shake
16+
end
17+
end
1318
end

0 commit comments

Comments
 (0)