main
 1require "spec_helper"
 2
 3class FizzBuzz
 4  def run(input)
 5  end
 6end
 7
 8describe "FizzBuzz" do
 9  let(:sut) { FizzBuzz.new }
10
11  context "when the input is a multiple of 3" do
12    it "should return Fizz" do
13      (1..10).each do |n|
14        result = sut.run(n*3)
15        result.should include("Fizz")
16      end
17    end
18  end
19
20  context "when the input is a multiple of 5" do
21    it "should say Buzz" do
22      (1..10).each do |n|
23        result = sut.run(n*5)
24        result.should include("Buzz")
25      end
26    end
27  end
28
29  context "when the input is not a multiple of 3" do
30    it "should not say Fizz" do
31      100.times do |n|
32        next if n % 3 == 0
33        sut.run(n).should_not include("Fizz")
34      end
35    end
36  end
37
38  context "when the input is not a multiple of 5" do
39    it "should not say Buzz" do
40      100.times do |n|
41        next if n % 5 == 0
42        sut.run(n).should_not include("Buzz")
43      end
44    end
45  end
46end