Created
May 19, 2018 21:00
-
-
Save sulmanweb/844e9bf75464126acb4fd42df9a20b86 to your computer and use it in GitHub Desktop.
RSpec file for binary search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'binary_search' | |
RSpec.describe BinarySearch, "#sort_func" do | |
context "with array searches the required" do | |
it "searches!" do | |
binary_search = BinarySearch.new | |
expect(binary_search.search_func([1, 2, 3, 4, 5, 6, 7, 8], 5)).to eql 4 | |
end | |
it "return string if not found" do | |
binary_search = BinarySearch.new | |
expect(binary_search.search_func([1, 2, 3, 4, 5, 6, 7, 8], 9)).to eql "Value not found in array" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment