-
-
Save magnusstahre/1224172 to your computer and use it in GitHub Desktop.
Teaching my 10yr old daughter about ROT-13
This file contains 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
class String | |
def rot13 | |
tr 'abcdefghijklmnopqrstuvwxyz', 'nopqrstuvwxyzabcdefghijklm' | |
end | |
end | |
describe 'String#rot13' do | |
let (:message) { "the quick brown fox jumps over the lazy dog" } | |
let (:encoded) { "gur dhvpx oebja sbk whzcf bire gur ynml qbt" } | |
specify do | |
message.rot13.should == encoded | |
end | |
specify do | |
encoded.rot13.should == message | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment