main
 1require "spec_helper"
 2
 3def sum_of_all_multiples_under(number)
 4  matches = ->  (n) { n % 3 == 0 || n % 5 == 0 }
 5  (0...number).inject(0) do |sum, next_number|
 6    matches.call(next_number) ? sum + next_number : sum
 7  end
 8end
 9
10describe "problem 1" do
11  it "finds the sum of all multiples of 3 or 5 below 10" do
12    result = sum_of_all_multiples_under(10)
13    expect(result).to eq(23)
14  end
15
16  it "finds the sum of all multiples of 3 or 5 below 1000" do
17    result = sum_of_all_multiples_under(1000)
18    expect(result).to eq(233_168)
19  end
20end