Sha256: 62453b8170b6cb300aa3e204ec1ba913f7da6d6e8ec259d99621c848edfa7c76
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') # require 'spec_helper' # require_relative '../lib/fib' describe "#fibonacci" do it "should have a method named fibonacci" do expect(method(:fibonacci)) end it "should have one required parameter" do parameters = method(:fibonacci).parameters expect(parameters.length).to eq 1 expect(parameters[0].length).to eq 2 expect(parameters[0]).to include(:req) end it "should return an array" do expect(fibonacci(3).class).to be Array end it "should return num digits of the fibonacci sequence" do expect(fibonacci(8).length).to eq 8 end it "should return the fibonacci sequence" do expect(fibonacci(4)).to eq [1, 1, 2, 3] expect(fibonacci(9)).to eq [1, 1, 2, 3, 5, 8, 13, 21, 34] expect(fibonacci(0)).to eq [] expect(fibonacci(1)).to eq [1] expect(fibonacci(2)).to eq [1, 1] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fibonacci-generator-ah-0.1.0 | spec/fibonacci-generator-ah_spec.rb |