diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-19 23:31:05 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-19 23:31:05 +0100 |
commit | e6875cb0f3513fbc8609629d4a1a033b38e82716 (patch) | |
tree | d92d20081b7695f4989fbb0aeceb4cd618823648 /spec/javascripts/helpers/class_spec_helper_spec.js.es6 | |
parent | 31af6be076635e6c6936564558bb977740d39eb0 (diff) | |
parent | 1c81452a9955bb06515faf26cedbe8e2b28791d5 (diff) | |
download | gitlab-ce-e6875cb0f3513fbc8609629d4a1a033b38e82716.tar.gz |
Merge remote-tracking branch 'origin/master' into 21698-redis-runner-last-build
Diffstat (limited to 'spec/javascripts/helpers/class_spec_helper_spec.js.es6')
-rw-r--r-- | spec/javascripts/helpers/class_spec_helper_spec.js.es6 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/javascripts/helpers/class_spec_helper_spec.js.es6 b/spec/javascripts/helpers/class_spec_helper_spec.js.es6 new file mode 100644 index 00000000000..d1155f1bd1e --- /dev/null +++ b/spec/javascripts/helpers/class_spec_helper_spec.js.es6 @@ -0,0 +1,35 @@ +/* global ClassSpecHelper */ +//= require ./class_spec_helper + +describe('ClassSpecHelper', () => { + describe('.itShouldBeAStaticMethod', function () { + beforeEach(() => { + class TestClass { + instanceMethod() { this.prop = 'val'; } + static staticMethod() {} + } + + this.TestClass = TestClass; + }); + + ClassSpecHelper.itShouldBeAStaticMethod(ClassSpecHelper, 'itShouldBeAStaticMethod'); + + it('should have a defined spec', () => { + expect(ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'staticMethod').description).toBe('should be a static method'); + }); + + it('should pass for a static method', () => { + const spec = ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'staticMethod'); + expect(spec.status()).toBe('passed'); + }); + + it('should fail for an instance method', (done) => { + const spec = ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'instanceMethod'); + spec.resultCallback = (result) => { + expect(result.status).toBe('failed'); + done(); + }; + spec.execute(); + }); + }); +}); |