Skip to content

Commit

Permalink
overwrite urls using config unless safe
Browse files Browse the repository at this point in the history
  • Loading branch information
dasilvacontin committed Jun 15, 2015
1 parent 2a31021 commit 79d5f94
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 0 additions & 4 deletions lib/gh-sauce.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ module.exports.dress = function (text, config) {
return hash.slice(0, -1) + '[#' + issue + ']'
})

if (_.size(issues) + _.size(users) === 0) {
return text
}

dressed = _.trimRight(dressed)
dressed = dressed.split('\n')

Expand Down
27 changes: 19 additions & 8 deletions test/gh-sauce.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ describe('gh-sauce', function () {
}).should.throw(TypeError)
})

it('shouldn\'t change the text if there is nothing to improve', function () {
var text = 'nothing to enhance'
sauce.dress(text).should.equal(text)

text += '\n'
sauce.dress(text).should.equal(text)
})

it('should enhance usernames', function () {
sauce.dress('fix bail not running after hooks by @dasilvacontin')
.should.equal([
Expand Down Expand Up @@ -137,6 +129,25 @@ describe('gh-sauce', function () {
].join('\n'))
})

it('must be able to overwrite urls', function () {
var config = {
repo: 'https://github.com/dasilvacontin/gh-sauce'
}

sauce.dress([
'fixes [#27]',
'',
'[#27]: https://github.com/mochajs/mocha/issues/27',
''
].join('\n'), config)
.should.equal([
'fixes [#27]',
'',
'[#27]: https://github.com/dasilvacontin/gh-sauce/issues/27',
''
].join('\n'))
})

it('should throw a TypeError for invalid config for `repo`', function () {
(function () {
var config = {
Expand Down

0 comments on commit 79d5f94

Please sign in to comment.