Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Wrap base filter specs into describe function

  • Loading branch information...
commit d18710a832a3d31fbfb0fbeab5671a8d314e8860 1 parent e6d8ac1
Sasha Koss authored

Showing 1 changed file with 36 additions and 33 deletions. Show diff stats Hide diff stats

  1. 69  spec/gtl_spec.coffee
69  spec/gtl_spec.coffee
@@ -11,47 +11,50 @@ describe 'Greater than less', ->
11 11
 
12 12
   describe 'gtl.filter function', ->
13 13
 
14  
-    it 'should filter array with greaterThan rule', ->
15  
-      gtl.filter([1, 2, 3, 4, 5], greaterThan: 3).should.eql [4, 5]
16  
-      gtl.filter([1, 2, 3, 4, 5], gt: 3).should.eql [4, 5]
  14
+    describe 'filter with base rules', ->
17 15
 
18  
-    it 'should filter array of strings with greaterThan rule', ->
19  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], greaterThan: 'c').should.eql ['d', 'e']
  16
+      it 'should filter array with greaterThan rule', ->
  17
+        gtl.filter([1, 2, 3, 4, 5], greaterThan: 3).should.eql [4, 5]
  18
+        gtl.filter([1, 2, 3, 4, 5], gt: 3).should.eql [4, 5]
20 19
 
21  
-    it 'should filter array with greaterThanOrEqualTo rule', ->
22  
-      gtl.filter([1, 2, 3, 4, 5], greaterThanOrEqualTo: 3).should.eql [3, 4, 5]
23  
-      gtl.filter([1, 2, 3, 4, 5], gte: 3).should.eql [3, 4, 5]
24  
-      gtl.filter([1, 2, 3, 4, 5], gteq: 3).should.eql [3, 4, 5]
  20
+      it 'should filter array of strings with greaterThan rule', ->
  21
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], greaterThan: 'c').should.eql ['d', 'e']
25 22
 
26  
-    it 'should filter array of strings with greaterThanOrEqualTo rule', ->
27  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], greaterThanOrEqualTo: 'c').should.eql ['c', 'd', 'e']
  23
+      it 'should filter array with greaterThanOrEqualTo rule', ->
  24
+        gtl.filter([1, 2, 3, 4, 5], greaterThanOrEqualTo: 3).should.eql [3, 4, 5]
  25
+        gtl.filter([1, 2, 3, 4, 5], gte: 3).should.eql [3, 4, 5]
  26
+        gtl.filter([1, 2, 3, 4, 5], gteq: 3).should.eql [3, 4, 5]
28 27
 
29  
-    it 'should filter array with lessThan rule', ->
30  
-      gtl.filter([1, 2, 3, 4, 5], lessThan: 3).should.eql [1, 2]
31  
-      gtl.filter([1, 2, 3, 4, 5], lt: 3).should.eql [1, 2]
  28
+      it 'should filter array of strings with greaterThanOrEqualTo rule', ->
  29
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], greaterThanOrEqualTo: 'c').should.eql ['c', 'd', 'e']
32 30
 
33  
-    it 'should filter array of strings with lessThan rule', ->
34  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], lessThan: 'c').should.eql ['a', 'b']
  31
+      it 'should filter array with lessThan rule', ->
  32
+        gtl.filter([1, 2, 3, 4, 5], lessThan: 3).should.eql [1, 2]
  33
+        gtl.filter([1, 2, 3, 4, 5], lt: 3).should.eql [1, 2]
35 34
 
36  
-    it 'should filter array with lessThanOrEqualTo rule', ->
37  
-      gtl.filter([1, 2, 3, 4, 5], lessThanOrEqualTo: 3).should.eql [1, 2, 3]
38  
-      gtl.filter([1, 2, 3, 4, 5], lte: 3).should.eql [1, 2, 3]
39  
-      gtl.filter([1, 2, 3, 4, 5], lteq: 3).should.eql [1, 2, 3]
  35
+      it 'should filter array of strings with lessThan rule', ->
  36
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], lessThan: 'c').should.eql ['a', 'b']
40 37
 
41  
-    it 'should filter array of strings with lessThanOrEqualTo rule', ->
42  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], lessThanOrEqualTo: 'c').should.eql ['a', 'b', 'c']
  38
+      it 'should filter array with lessThanOrEqualTo rule', ->
  39
+        gtl.filter([1, 2, 3, 4, 5], lessThanOrEqualTo: 3).should.eql [1, 2, 3]
  40
+        gtl.filter([1, 2, 3, 4, 5], lte: 3).should.eql [1, 2, 3]
  41
+        gtl.filter([1, 2, 3, 4, 5], lteq: 3).should.eql [1, 2, 3]
43 42
 
44  
-    it 'should filter array with only rule', ->
45  
-      gtl.filter([1, 2, 3, 4, 5], only: 2).should.eql [2]
46  
-      gtl.filter([1, 2, 3, 4, 5], only: [1, 2]).should.eql [1, 2]
  43
+      it 'should filter array of strings with lessThanOrEqualTo rule', ->
  44
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], lessThanOrEqualTo: 'c').should.eql ['a', 'b', 'c']
47 45
 
48  
-    it 'should filter array of strings with only rule', ->
49  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], only: 'c').should.eql ['c']
  46
+      it 'should filter array with only rule', ->
  47
+        gtl.filter([1, 2, 3, 4, 5], only: 2).should.eql [2]
  48
+        gtl.filter([1, 2, 3, 4, 5], only: [1, 2]).should.eql [1, 2]
50 49
 
51  
-    it 'should filter array with except rule', ->
52  
-      gtl.filter([1, 2, 3, 4, 5], except: 3).should.eql [1, 2, 4, 5]
53  
-      gtl.filter([1, 2, 3, 4, 5], not: 3).should.eql [1, 2, 4, 5]
54  
-      gtl.filter([1, 2, 3, 4, 5], except: [1, 2]).should.eql [3, 4, 5]
  50
+      it 'should filter array of strings with only rule', ->
  51
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], only: 'c').should.eql ['c']
  52
+
  53
+      it 'should filter array with except rule', ->
  54
+        gtl.filter([1, 2, 3, 4, 5], except: 3).should.eql [1, 2, 4, 5]
  55
+        gtl.filter([1, 2, 3, 4, 5], not: 3).should.eql [1, 2, 4, 5]
  56
+        gtl.filter([1, 2, 3, 4, 5], except: [1, 2]).should.eql [3, 4, 5]
  57
+
  58
+      it 'should filter array of strings with except rule', ->
  59
+        gtl.filter(['a', 'b', 'c', 'd', 'e'], except: ['a', 'c']).should.eql ['b', 'd', 'e']
55 60
 
56  
-    it 'should filter array of strings with except rule', ->
57  
-      gtl.filter(['a', 'b', 'c', 'd', 'e'], except: ['a', 'c']).should.eql ['b', 'd', 'e']

0 notes on commit d18710a

Please sign in to comment.
Something went wrong with that request. Please try again.