summaryrefslogtreecommitdiff
path: root/spec/javascripts/helpers/class_spec_helper_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/helpers/class_spec_helper_spec.js')
-rw-r--r--spec/javascripts/helpers/class_spec_helper_spec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/helpers/class_spec_helper_spec.js b/spec/javascripts/helpers/class_spec_helper_spec.js
new file mode 100644
index 00000000000..0a61e561640
--- /dev/null
+++ b/spec/javascripts/helpers/class_spec_helper_spec.js
@@ -0,0 +1,36 @@
+/* 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();
+ });
+ });
+});