master
1# Each new term in the Fibonacci sequence is generated by adding the previous two terms.
2## By starting with 1 and 2, the first 10 terms will be:
3#
4## 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
5#
6## By considering the terms in the Fibonacci sequence whose values do not exceed
7## four million, find the sum of the even-valued terms.
8
9class Fibonacci
10end
11
12describe "fibonacci" do
13 subject { Fibonacci.new }
14
15 xit 'returns the sum of the even valued terms' do
16 items = subject.take_while { |n| n < 4_000_000 }.find_all(&:even?)
17 result = items.inject(0) { |memo, x| memo + x }
18 expect(result).to eql(4613732)
19 end
20end