Skip to content

Instantly share code, notes, and snippets.

@kunalbhatt
Created October 21, 2012 22:31
Show Gist options
  • Select an option

  • Save kunalbhatt/3928770 to your computer and use it in GitHub Desktop.

Select an option

Save kunalbhatt/3928770 to your computer and use it in GitHub Desktop.
Minitest with Expectations
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