Created
October 21, 2012 22:31
-
-
Save kunalbhatt/3928770 to your computer and use it in GitHub Desktop.
Minitest with Expectations
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/autorun' | |
| require 'minitest/spec' | |
| def switcharoo(string, switch_point, second_switch_point = nil) | |
| first = string.slice(0...switch_point) | |
| second = string.slice(switch_point..-1) | |
| second + first | |
| end | |
| describe "switcharoo" do | |
| it "handles a switch in the middle" do | |
| switcharoo("bootcamp", 4).must_match "campboot"# switcharoo("pdqxyz", 3).must....."xyzpdq" | |
| end | |
| it "handles a switch at the end and a switch at the beginning" do | |
| switcharoo("bootcamp", 8, 1).must_match "bootcamp" | |
| end | |
| it "handles a switch " | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment