require 'simplecov'
SimpleCov.start
require './binary_search.rb'


describe "#binary_search" do
  let(:array_1) { [1,2,3,4,5,6,7] }
  let(:array_2) { ["apple", "pear", "banana", "pineapple", "kiwi"].sort}
  
  it "is defined as a method" do
    defined?(binary_search).should eq 'method'
  end
  
  it "requires two arguments" do
    method(:binary_search).arity.should eq 2
  end
  
  it "returns the correct value for a simple array of numbers" do
    binary_search(4, array_1).should eq 3
  end
  
  it "returns the correct value for an array of strings" do
    binary_search("pear", array_2).should eq 3
  end
end