Commit 8aed815b authored by Rémy Coutable's avatar Rémy Coutable

Avoid a TypeError when initializing MergeRequest JS class with no arg

Without this sane default you would get the following error when you
tried to instantiate a new MergeRequest object with no argument (i.e.
`new MergeRequest();`):

TypeError: undefined is not an object (evaluating 'this.opts.action')
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent d8563bd6
......@@ -9,7 +9,7 @@ class @MergeRequest
# Options:
# action - String, current controller action
#
constructor: (@opts) ->
constructor: (@opts = {}) ->
this.$el = $('.merge-request')
this.$('.show-all-commits').on 'click', =>
......
......@@ -6,7 +6,7 @@ describe 'MergeRequest', ->
beforeEach ->
fixture.load('merge_requests_show.html')
@merge = new MergeRequest({})
@merge = new MergeRequest()
it 'modifies the Markdown field', ->
spyOn(jQuery, 'ajax').and.stub()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment