summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2015-12-21 16:27:52 -0500
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2015-12-21 16:27:52 -0500
commitfec7c99e2f2221f22680c140b7d9b1d959d8aeb0 (patch)
tree8d1edd50e0a4caceb111d1cc6382c680beb9c6fa /spec/javascripts
parent531d06d170fd5cfcb6d4f6c919034c49266e42e9 (diff)
downloadgitlab-ce-fec7c99e2f2221f22680c140b7d9b1d959d8aeb0.tar.gz
updates tests style for four-phase-testing as per: https://robots.thoughtbot.com/four-phase-test
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/issue_spec.js.coffee18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/javascripts/issue_spec.js.coffee b/spec/javascripts/issue_spec.js.coffee
index 60df3a8878b..f8e60565b9a 100644
--- a/spec/javascripts/issue_spec.js.coffee
+++ b/spec/javascripts/issue_spec.js.coffee
@@ -30,29 +30,45 @@ describe 'reopen/close issue', ->
expect(obj.type).toBe('PUT')
expect(obj.url).toBe('http://gitlab/issues/6/close')
obj.success saved: true
+
+ # setup
$btnClose = $('a.btn-close')
$btnReopen = $('a.btn-reopen')
expect($btnReopen.hasClass('hidden')).toBe(true)
expect($btnClose.text()).toBe('Close')
expect(typeof $btnClose.prop('disabled')).toBe('undefined')
+
+ # excerize
$btnClose.trigger('click')
+
+ # verify
expect($btnClose.hasClass('hidden')).toBe(true)
expect($btnReopen.hasClass('hidden')).toBe(false)
expect($btnClose.prop('disabled')).toBe(false)
expect($('div.issue-box-open').hasClass('hidden')).toBe(true)
expect($('div.issue-box-closed').hasClass('hidden')).toBe(false)
+
+ # teardown
it 'reopens an issue', ->
$.ajax = (obj) ->
expect(obj.type).toBe('PUT')
expect(obj.url).toBe('http://gitlab/issues/6/reopen')
obj.success saved: true
+
+ # setup
$btnClose = $('a.btn-close')
$btnReopen = $('a.btn-reopen')
expect(typeof $btnReopen.prop('disabled')).toBe('undefined')
expect($btnReopen.text()).toBe('Reopen')
+
+ # excerize
$btnReopen.trigger('click')
+
+ # verify
expect($btnReopen.hasClass('hidden')).toBe(true)
expect($btnClose.hasClass('hidden')).toBe(false)
expect($btnReopen.prop('disabled')).toBe(false)
expect($('div.issue-box-open').hasClass('hidden')).toBe(false)
- expect($('div.issue-box-closed').hasClass('hidden')).toBe(true) \ No newline at end of file
+ expect($('div.issue-box-closed').hasClass('hidden')).toBe(true)
+
+ # teardown \ No newline at end of file