Created
April 1, 2013 23:32
-
-
Save TheNotary/5288676 to your computer and use it in GitHub Desktop.
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
def test_youtube_parser | |
url1 = "http://www.youtube.com/watch?v=E4Fbk52Mk1w" | |
just_an_id = 'E4Fbk52Mk1w' | |
url_without_http = "www.youtube.com/watch?v=E4Fbk52Mk1w" | |
url_without_www = "youtube.com/watch?v=E4Fbk52Mk1w" | |
url_with_feature = "http://www.youtube.com/watch?feature=player_embedded&v=E4Fbk52Mk1w" | |
expected_output = 'E4Fbk52Mk1w' | |
assert_equal expected_output, | |
RubyBBCode.parse_youtube_id(url1) | |
assert_equal expected_output, | |
RubyBBCode.parse_youtube_id(just_an_id) | |
assert_equal expected_output, | |
RubyBBCode.parse_youtube_id(url_without_http) | |
assert_equal expected_output, | |
RubyBBCode.parse_youtube_id(url_without_www) | |
assert_equal expected_output, | |
RubyBBCode.parse_youtube_id(url_with_feature) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment