diff options
author | Benedikt Huss <benedikt.huss@gmail.com> | 2016-05-04 09:34:25 +0200 |
---|---|---|
committer | Benedikt Huss <benedikt.huss@gmail.com> | 2016-05-05 00:07:56 +0200 |
commit | 655b2640ae9cbe2737369401969e99caeddf192d (patch) | |
tree | ad1df021f590dd7b0770ef4cd1980bf13086ff5b /spec/javascripts | |
parent | 915a4193b433575a63fd4f5048b341d417b06426 (diff) | |
download | gitlab-ce-655b2640ae9cbe2737369401969e99caeddf192d.tar.gz |
Merge request widget displays TeamCity build state and code coverage correctly again
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/merge_request_widget_spec.js.coffee | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/javascripts/merge_request_widget_spec.js.coffee b/spec/javascripts/merge_request_widget_spec.js.coffee new file mode 100644 index 00000000000..e1fb610654e --- /dev/null +++ b/spec/javascripts/merge_request_widget_spec.js.coffee @@ -0,0 +1,35 @@ +#= require merge_request_widget + +describe 'MergeRequestWidget', -> + + beforeEach -> + window.notifyPermissions = () -> + @opts = {ci_status_url:"http://sampledomain.local/ci/getstatus",ci_status:""} + @class = new MergeRequestWidget(@opts) + @ciStatusData = {"title":"Sample MR title","sha":"12a34bc5","status":"success","coverage":98} + + describe 'getCIStatus', -> + beforeEach -> + spyOn(jQuery, 'getJSON').and.callFake (req, cb) => + cb(@ciStatusData) + + it 'should call showCIStatus even if a notification should not be displayed', -> + spy = spyOn(@class, 'showCIStatus').and.stub() + @class.getCIStatus(false) + expect(spy).toHaveBeenCalledWith(@ciStatusData.status) + + it 'should call showCIStatus when a notification should be displayed', -> + spy = spyOn(@class, 'showCIStatus').and.stub() + @class.getCIStatus(true) + expect(spy).toHaveBeenCalledWith(@ciStatusData.status) + + it 'should call showCICoverage when the coverage rate is set', -> + spy = spyOn(@class, 'showCICoverage').and.stub() + @class.getCIStatus(true) + expect(spy).toHaveBeenCalledWith(@ciStatusData.coverage) + + it 'should not call showCICoverage when the coverage rate is not set', -> + @ciStatusData.coverage = null + spy = spyOn(@class, 'showCICoverage').and.stub() + @class.getCIStatus(true) + expect(spy).not.toHaveBeenCalled() |