module "Travis.Helpers.githubify" test 'replaces #Num with github issues link', -> message = 'Solved #11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Solved #11hey' equal(result, expected, "#num should be converted to a link") test 'replaces User#Num with github issues link to forked repo', -> message = 'Solved test#11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Solved test#11hey' equal(result, expected, "user#num should be converted to a link") test 'replaces User/Project#Num with github issues link to another repo', -> message = 'Solved test_1-a2/test-a_11#11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Solved test_1-a2/test-a_11#11hey' equal(result, expected, "owner/repo#num should be converted to a link") test 'replaces gh-Num with github issues link', -> message = 'Solved gh-22hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Solved gh-22hey' equal(result, expected, "gh-Num should be converted to a link") test 'replaces multiple references with github issues links', -> message = 'Try #1 and test#2 and test/testing#3' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Try #1 and ' expected += 'test#2 and ' expected += 'test/testing#3' equal(result, expected, "references should be converted to links") test 'replaces multiple references with github issues links', -> message = 'Try #1 and test#2 and test/testing#3' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'Try #1 and ' expected += 'test#2 and ' expected += 'test/testing#3' equal(result, expected, "references should be converted to links") test 'replaces @user with github user link', -> message = 'It is for you @tender_love1' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'It is for you @tender_love1' equal(result, expected, "@user should be converted to a link") test 'does not replace @user if it is a sign-off', -> message = 'Signed-off-by: GitHub User ' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') equal(result, message, "@user should not be converted to a link if it matches an email") test 'replaces one commit reference with github commit link', -> message = 'See travis-ci/travis-core@732fe00' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'See travis-ci/travis-core@732fe00' equal(result, expected, "Commit reference should be converted to a link") test 'replaces multiple commit references with github commit links', -> message = 'See travis-ci/travis-core@732fe00 and travis-ci/travis-web@3b6aa17' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') expected = 'See travis-ci/travis-core@732fe00 and travis-ci/travis-web@3b6aa17' equal(result, expected, "Commit references should be converted to links")