Created
July 18, 2014 15:16
-
-
Save wconrad/9e1a906314e794b5aac6 to your computer and use it in GitHub Desktop.
Test case for a question asked in the SO ruby chat room
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://chat.stackoverflow.com/transcript/message/17785269#17785269