Created
February 24, 2014 04:46
-
-
Save townie/9182095 to your computer and use it in GitHub Desktop.
Fix for the path of the file to be tested
This file contains hidden or 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 'minitest/spec' | |
| require 'minitest/autorun' | |
| require_relative '../lib/rightmost_occurrence' | |
| describe "#rightmost_occurrence" do | |
| it "returns nil if no matches are found" do | |
| rightmost_occurrence('abc', 'x').must_equal nil | |
| end | |
| it "returns the correct index when is only character" do | |
| rightmost_occurrence('t', 't').must_equal 0 | |
| end | |
| it "returns the correct index when is in middle of string" do | |
| rightmost_occurrence('cat dog', 'd').must_equal 4 | |
| end | |
| it "returns the correct index when char occurs more than once" do | |
| rightmost_occurrence('cat dog tutu', 't').must_equal 10 | |
| end | |
| it "is not case sensitive" do | |
| rightmost_occurrence('Sometimes I like yOu', 'o').must_equal 18 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment