Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rspec"
- require "fizz_buzz"
- describe FizzBuzz do
- before :each do
- @fb = FizzBuzz.new
- end
- it 'should specify FizzBuzz for numbers divisible by 3 and 5' do
- @fb.fizz(-15).should == "FizzBuzz"
- @fb.fizz(0).should == "FizzBuzz"
- @fb.fizz(15).should == "FizzBuzz"
- @fb.fizz(30).should == "FizzBuzz"
- end
- it 'should specify Fizz for numbers divisible by 3' do
- @fb.fizz(-3).should == "Fizz"
- @fb.fizz(3).should == "Fizz"
- @fb.fizz(6).should == "Fizz"
- end
- it 'should display Buzz for numbers divisible by 5' do
- @fb.fizz(-5).should == "Buzz"
- @fb.fizz(5).should == "Buzz"
- end
- it 'should display the number for numbers not divisible by 3 or 5' do
- @fb.fizz(-1).should == "-1"
- @fb.fizz(1).should == "1"
- @fb.fizz(2).should == "2"
- @fb.fizz(4).should == "4"
- @fb.fizz(7).should == "7"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement