-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathfizzbuzz_spec.rb
More file actions
30 lines (28 loc) · 936 Bytes
/
fizzbuzz_spec.rb
File metadata and controls
30 lines (28 loc) · 936 Bytes
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
require 'rspec'
require 'fizzbuzz'
describe Fizzbuzz do
context 'normal number' do
it { subject.calculate(1).should eq 1 }
it { subject.calculate(2).should eq 2 }
end
context 'Fizz number' do
it { subject.calculate(3).should eq 'fizz' }
it { subject.calculate(6).should eq 'fizz' }
it { subject.calculate(9).should eq 'fizz' }
end
context 'buzz number' do
it { subject.calculate(5).should eq 'buzz' }
it { subject.calculate(10).should eq 'buzz' }
it { subject.calculate(20).should eq 'buzz' }
end
context 'fizzbuzz number' do
it { subject.calculate(15).should eq 'fizzbuzz' }
it { subject.calculate(30).should eq 'fizzbuzz' }
end
context 'GitHub number' do
it { subject.calculate(77).should eq 'GitHub' }
it { subject.calculate(17).should eq 'GitHub' }
it { subject.calculate(27).should eq 'GitHub' }
it { subject.calculate(75).should eq 'GitHub' }
end
end