Skip to content

Instantly share code, notes, and snippets.

@wconrad
Created July 18, 2014 15:16
Show Gist options
  • Save wconrad/9e1a906314e794b5aac6 to your computer and use it in GitHub Desktop.
Save wconrad/9e1a906314e794b5aac6 to your computer and use it in GitHub Desktop.
Test case for a question asked in the SO ruby chat room
describe "#remove_some_colons" do
it "should preserve an empty string" do
expect(remove_some_colons("")).to eq ""
end
it "should remove a lone colon" do
expect(remove_some_colons(":")).to eq ""
end
it "should remove a colon at BOS with a number after it" do
expect(remove_some_colons(":123")).to eq "123"
end
it "should remove a colon with a number after it" do
expect(remove_some_colons("abc:123")).to eq "abc123"
end
it "should remove a colon at EOS with a number before it" do
expect(remove_some_colons("123:")).to eq "123"
end
it "should remove a colon with a number before it" do
expect(remove_some_colons("123:abc")).to eq "123abc"
end
it "should preserve a colon that is between two numbers" do
expect(remove_some_colons("123:456")).to eq "123:456"
end
end
@wconrad
Copy link
Author

wconrad commented Jul 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment