flint-gs 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/flint/version.rb +1 -1
  3. data/stylesheets/flint/mixins/lib/_calculate.scss +1 -1
  4. data/tests/bootcamp/CHANGELOG.md +70 -0
  5. data/tests/bootcamp/CONTRIBUTING.md +72 -0
  6. data/tests/bootcamp/Gruntfile.coffee +34 -0
  7. data/tests/bootcamp/LICENSE.md +7 -0
  8. data/tests/bootcamp/README.md +52 -0
  9. data/tests/bootcamp/bower.json +15 -0
  10. data/tests/bootcamp/dist/_bootcamp.scss +46 -0
  11. data/tests/bootcamp/dist/bootcamp.coffee +101 -0
  12. data/tests/bootcamp/dist/core/functions/_actual.scss +3 -0
  13. data/tests/bootcamp/dist/core/functions/_error.scss +29 -0
  14. data/tests/bootcamp/dist/core/functions/_expect.scss +6 -0
  15. data/tests/bootcamp/dist/core/functions/_not-to.scss +5 -0
  16. data/tests/bootcamp/dist/core/functions/_should.scss +6 -0
  17. data/tests/bootcamp/dist/core/functions/_to.scss +5 -0
  18. data/tests/bootcamp/dist/core/mixins/_describe.scss +31 -0
  19. data/tests/bootcamp/dist/core/mixins/_it.scss +31 -0
  20. data/tests/bootcamp/dist/core/mixins/_runner.scss +28 -0
  21. data/tests/bootcamp/dist/core/mixins/_should.scss +46 -0
  22. data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +9 -0
  23. data/tests/bootcamp/dist/core/mixins/_xit.scss +9 -0
  24. data/tests/bootcamp/dist/core/variables/_helpers.scss +5 -0
  25. data/tests/bootcamp/dist/core/variables/_settings.scss +2 -0
  26. data/tests/bootcamp/dist/core/variables/_should.scss +6 -0
  27. data/tests/bootcamp/dist/core/variables/_trackers.scss +6 -0
  28. data/tests/bootcamp/dist/lib/_sassyjson.scss +1075 -0
  29. data/tests/bootcamp/dist/matchers/_be.scss +3 -0
  30. data/tests/bootcamp/dist/matchers/_equal.scss +3 -0
  31. data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +3 -0
  32. data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +3 -0
  33. data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +3 -0
  34. data/tests/bootcamp/dist/matchers/lists/_contain.scss +3 -0
  35. data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +3 -0
  36. data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +47 -0
  37. data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +3 -0
  38. data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +12 -0
  39. data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +12 -0
  40. data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +12 -0
  41. data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +3 -0
  42. data/tests/bootcamp/dist/matchers/types/_be-null.scss +3 -0
  43. data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +3 -0
  44. data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +3 -0
  45. data/tests/bootcamp/dist/utils/_contain.scss +15 -0
  46. data/tests/bootcamp/dist/utils/_equal.scss +23 -0
  47. data/tests/bootcamp/dist/utils/_list-join.scss +35 -0
  48. data/tests/bootcamp/dist/utils/_power.scss +15 -0
  49. data/tests/bootcamp/package.json +63 -0
  50. data/tests/bootcamp/tasks/bootcamp.coffee +83 -0
  51. data/tests/bootcamp/test/core/functions/_actual.scss +10 -0
  52. data/tests/bootcamp/test/core/functions/_expect.scss +6 -0
  53. data/tests/bootcamp/test/core/functions/_not-to.scss +5 -0
  54. data/tests/bootcamp/test/core/functions/_should.scss +10 -0
  55. data/tests/bootcamp/test/core/functions/_to.scss +5 -0
  56. data/tests/bootcamp/test/core/mixins/_describe.scss +11 -0
  57. data/tests/bootcamp/test/core/mixins/_it.scss +5 -0
  58. data/tests/bootcamp/test/core/mixins/_should.scss +5 -0
  59. data/tests/bootcamp/test/core/mixins/_xdescribe.scss +28 -0
  60. data/tests/bootcamp/test/core/mixins/_xit.scss +12 -0
  61. data/tests/bootcamp/test/matchers/_be.scss +90 -0
  62. data/tests/bootcamp/test/matchers/_equal.scss +33 -0
  63. data/tests/bootcamp/test/matchers/lists/_be-empty.scss +12 -0
  64. data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +29 -0
  65. data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +29 -0
  66. data/tests/bootcamp/test/matchers/lists/_contain.scss +39 -0
  67. data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +51 -0
  68. data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +151 -0
  69. data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +31 -0
  70. data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +24 -0
  71. data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +16 -0
  72. data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +16 -0
  73. data/tests/bootcamp/test/matchers/types/_be-falsy.scss +14 -0
  74. data/tests/bootcamp/test/matchers/types/_be-null.scss +13 -0
  75. data/tests/bootcamp/test/matchers/types/_be-truthy.scss +13 -0
  76. data/tests/bootcamp/test/matchers/types/_have-type-of.scss +17 -0
  77. data/tests/bootcamp/test/specs.scss +45 -0
  78. data/tests/bootcamp/test/utils/_contain.scss +41 -0
  79. data/tests/bootcamp/test/utils/_equal.scss +79 -0
  80. data/tests/bootcamp/test/utils/_list-join.scss +39 -0
  81. data/tests/bootcamp/test/utils/_power.scss +13 -0
  82. metadata +159 -2
@@ -0,0 +1,3 @@
1
+ @function be($value) {
2
+ @return should("be", $value, bc-util-equal( actual(), $value ) );
3
+ }
@@ -0,0 +1,3 @@
1
+ @function equal($value) {
2
+ @return should("equal", $value, actual() == $value);
3
+ }
@@ -0,0 +1,3 @@
1
+ @function be-empty() {
2
+ @return should("be", "empty", actual() == ());
3
+ }
@@ -0,0 +1,3 @@
1
+ @function be-longer-than($this) {
2
+ @return should("be longer than", $this, length(actual()) > $this);
3
+ }
@@ -0,0 +1,3 @@
1
+ @function be-shorter-than($this) {
2
+ @return should("be shorter than", $this, length(actual()) < $this);
3
+ }
@@ -0,0 +1,3 @@
1
+ @function contain($value) {
2
+ @return should("deep contain", $value, bc-util-contain( actual(), $value ));
3
+ }
@@ -0,0 +1,3 @@
1
+ @function deep-contain($value) {
2
+ @return should("deep contain", $value, bc-util-contain( actual(), $value, $recursive: true ));
3
+ }
@@ -0,0 +1,47 @@
1
+ @function deep-equal($expected) {
2
+ $when: true;
3
+ $actual: actual();
4
+
5
+ $contains-list: true;
6
+ $temp-1: $actual;
7
+ $temp-2: $expected;
8
+
9
+ @while $contains-list {
10
+ $contains-list: false;
11
+
12
+ @if length($temp-1) == length($temp-2) {
13
+ @for $n from 1 through length($temp-1) {
14
+ $temp-1-item: nth($temp-1, $n);
15
+ $temp-2-item: nth($temp-2, $n);
16
+
17
+ @if type-of($temp-1-item) == "list" and type-of($temp-2-item) == "list" {
18
+ @if length($temp-1-item) == length($temp-2-item) {
19
+ @for $_n from 1 through length($temp-1-item) {
20
+ $_temp-1-item: nth($temp-1-item, $_n);
21
+ $_temp-2-item: nth($temp-2-item, $_n);
22
+
23
+ @if type-of($_temp-1-item) == "list" and type-of($_temp-2-item) == "list" {
24
+ $contains-list: true;
25
+ } @else if $_temp-1-item != $_temp-2-item {
26
+ $when: false;
27
+ }
28
+
29
+ $temp-1: $_temp-1-item;
30
+ $temp-2: $_temp-2-item;
31
+ }
32
+ } @else {
33
+ $when: false;
34
+ }
35
+ } @else if $temp-1-item != $temp-2-item {
36
+ $when: false;
37
+ }
38
+ }
39
+ } @else {
40
+ $when: false;
41
+ }
42
+ }
43
+
44
+ $throw: error("dep", "The `deep-equal` matcher has been deprecated, please use the `be` matcher for the same functionality");
45
+
46
+ @return should("deep equal", $expected, $when);
47
+ }
@@ -0,0 +1,3 @@
1
+ @function have-length-of($this) {
2
+ @return should("have length of", $this, length(actual()) == $this );
3
+ }
@@ -0,0 +1,12 @@
1
+ @function be-close-to($this, $precision) {
2
+ $actual: actual();
3
+ $when: false;
4
+
5
+ @if type-of($actual) == "number" {
6
+ $when: abs($this - $actual) < (bc-util-power(10, -$precision) / 2);
7
+ } @else {
8
+ $when: error("type", "The `be-close-to` matcher is only for numbers");
9
+ }
10
+
11
+ @return should("be close to", $this, $when);
12
+ }
@@ -0,0 +1,12 @@
1
+ @function be-greater-than($this) {
2
+ $actual: actual();
3
+ $when: false;
4
+
5
+ @if type-of($actual) == "number" {
6
+ $when: $actual > $this;
7
+ } @else {
8
+ $when: error("type", "The `be-greater-than` matcher is only for numbers");
9
+ }
10
+
11
+ @return should("be greater than", $this, $when);
12
+ }
@@ -0,0 +1,12 @@
1
+ @function be-less-than($this) {
2
+ $actual: actual();
3
+ $when: false;
4
+
5
+ @if type-of($actual) == "number" {
6
+ $when: $actual < $this;
7
+ } @else {
8
+ $when: error("type", "The `be-less-than` matcher is only for numbers");
9
+ }
10
+
11
+ @return should("be less than", $this, $when);
12
+ }
@@ -0,0 +1,3 @@
1
+ @function be-falsy() {
2
+ @return should("be", "falsy", not actual());
3
+ }
@@ -0,0 +1,3 @@
1
+ @function be-null() {
2
+ @return should("be", "null", actual() == null);
3
+ }
@@ -0,0 +1,3 @@
1
+ @function be-truthy() {
2
+ @return should("be", "truthy", not not actual());
3
+ }
@@ -0,0 +1,3 @@
1
+ @function have-type-of($type) {
2
+ @return should("have type of", $type, type-of(actual()) == $type);
3
+ }
@@ -0,0 +1,15 @@
1
+ @function bc-util-contain($list, $value, $recursive: false) {
2
+ @each $item in $list {
3
+ @if type-of( $item ) == list and $recursive {
4
+ @if bc-util-contain($item, $value, $recursive) {
5
+ @return true;
6
+ }
7
+ }
8
+
9
+ @if $item == $value {
10
+ @return true;
11
+ }
12
+ }
13
+
14
+ @return false;
15
+ }
@@ -0,0 +1,23 @@
1
+ @function bc-util-equal($value-1, $value-2, $recursive: true) {
2
+ @if length($value-1) != length($value-2) {
3
+ @return false;
4
+ }
5
+
6
+ @for $i from 1 through length($value-1) {
7
+
8
+ @if $recursive
9
+ and type-of( nth($value-1, $i) ) == list
10
+ and type-of( nth($value-2, $i) ) == list {
11
+
12
+ @if not bc-util-equal(nth($value-1, $i), nth($value-2, $i)) {
13
+ @return false;
14
+ }
15
+ }
16
+
17
+ @else if nth($value-1, $i) != nth($value-2, $i){
18
+ @return false;
19
+ }
20
+ }
21
+
22
+ @return true;
23
+ }
@@ -0,0 +1,35 @@
1
+ @function bc-util-list-join($list, $separator, $slice-start: 1, $slice-end: 0) {
2
+ $result: "";
3
+
4
+ @if type-of($list) == list {
5
+ $length: length($list);
6
+
7
+ @if $slice-end == false {
8
+ $slice-end: length($list);
9
+ }
10
+
11
+ @if $slice-start < 0 {
12
+ $slice-start: length($list) + $slice-start + 1;
13
+ }
14
+
15
+ @if $slice-end < 0 {
16
+ $slice-end: length($list) + $slice-end + 1;
17
+ }
18
+
19
+ @for $i from $slice-start through $length - $slice-end {
20
+ @if $result == "" {
21
+ $result: nth($list, $i);
22
+ }
23
+
24
+ @else {
25
+ $result: $result + "#{$separator}" + nth($list, $i);
26
+ }
27
+ }
28
+ }
29
+
30
+ @else {
31
+ $result: $list;
32
+ }
33
+
34
+ @return $result;
35
+ }
@@ -0,0 +1,15 @@
1
+ @function bc-util-power($x, $n) {
2
+ $ret: 1;
3
+
4
+ @if $n >= 0 {
5
+ @for $i from 1 through $n {
6
+ $ret: $ret * $x;
7
+ }
8
+ } @else {
9
+ @for $i from $n to 0 {
10
+ $ret: $ret / $x;
11
+ }
12
+ }
13
+
14
+ @return $ret;
15
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "bootcamp",
3
+ "version": "1.1.7",
4
+ "description": "A pure Sass testing framework in the style of Jasmine",
5
+ "keywords": [
6
+ "bootcamp",
7
+ "sass",
8
+ "scss",
9
+ "test",
10
+ "jasmine",
11
+ "gruntplugin",
12
+ "bower"
13
+ ],
14
+ "homepage": "https://github.com/thejameskyle/bootcamp",
15
+ "bugs": "https://github.com/thejameskyle/bootcamp/issues",
16
+ "author": {
17
+ "name": "James Kyle",
18
+ "email": "me@thejameskyle.com",
19
+ "url": "https://github.com/thejameskyle"
20
+ },
21
+ "contributors": [
22
+ {
23
+ "name": "James Kyle",
24
+ "email": "me@thejameskyle.com",
25
+ "url": "https://github.com/thejameskyle"
26
+ }
27
+ ],
28
+ "main": "dist/bootcamp.coffee",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git://github.com/thejameskyle/bootcamp.git"
32
+ },
33
+ "scripts": {
34
+ "test": "grunt test"
35
+ },
36
+ "files": [
37
+ "dist/",
38
+ "tasks/"
39
+ ],
40
+ "bin": {},
41
+ "dependencies": {
42
+ "colors": "^0.6.2"
43
+ },
44
+ "devDependencies": {
45
+ "grunt": "^0.4.5",
46
+ "grunt-contrib-sass": "^0.8.0",
47
+ "grunt-contrib-watch": "^0.6.1"
48
+ },
49
+ "peerDependencies": {
50
+ "grunt": "^0.4.5",
51
+ "grunt-contrib-sass": "^0.8.0"
52
+ },
53
+ "engines": {
54
+ "node": ">=0.8.0",
55
+ "npm": ">=1.2.10"
56
+ },
57
+ "licenses": [
58
+ {
59
+ "type": "MIT",
60
+ "url": "https://github.com/thejameskyle/bootcamp/blob/master/LICENSE.md"
61
+ }
62
+ ]
63
+ }
@@ -0,0 +1,83 @@
1
+ 'use strict'
2
+
3
+ bootcamp = require '../dist/bootcamp.coffee'
4
+ colors = require 'colors'
5
+
6
+ module.exports = (grunt) ->
7
+
8
+ grunt.registerMultiTask 'bootcamp', 'Jasmine-style BDD testing written in Sass for Sass.', ->
9
+
10
+ class bootcamp.gruntTask
11
+ constructor: (@tests) ->
12
+ if @tests.incomplete
13
+ @isIncomplete()
14
+ else if @tests.success and @tests.test == 0
15
+ @isEmpty
16
+ else if @tests.success
17
+ @hasPassed()
18
+ else
19
+ @hasFailed()
20
+
21
+ log: (string) -> grunt.log.writeln string
22
+ pass: (string) -> grunt.log.success string
23
+ warn: (string) -> grunt.log.warn string
24
+ fail: (string) -> grunt.fail.warn string
25
+
26
+ logStats: ->
27
+ stats = @tests.stats + ''
28
+ stats = stats.replace /✔/g, '✔'.green
29
+ stats = stats.replace /✗/g, '✗'.red
30
+ @log stats
31
+
32
+ logSpecs: ->
33
+ specs = @tests.specs + ''
34
+ specs = specs.replace /✔/g, '✔'.green
35
+ specs = specs.replace /✗/g, '✗'.red
36
+ specs = specs.replace /Test Passed/g, 'Test passed'.green
37
+ specs = specs.replace /Test Failed/g, 'Test failed'.red
38
+ specs = specs.replace /!(.*)!(.*)\./g, '$1:$2.'.yellow
39
+ specs = specs.trim()
40
+ if specs != ''
41
+ @log '\n' + specs + '\n'
42
+
43
+ logErrors: ->
44
+ if !@tests.errors then return null
45
+ @log ''
46
+
47
+ for error in @tests.errors
48
+ error = error + ''
49
+ error = error.replace /!(.*)!(.*)/g, '$1:'.red + '$2'.yellow
50
+ @log error.yellow
51
+
52
+ isIncomplete: ->
53
+ @fail @tests.error.yellow
54
+ return true
55
+
56
+ isEmpty: ->
57
+ @logStats()
58
+ @warn 'Your tests probably haven\'t been properly set up.\nTake a look at https://github.com/thejameskyle/bootcamp/wiki/setup'
59
+ return true
60
+
61
+ hasFailed: ->
62
+ @logSpecs()
63
+ @logStats()
64
+ @fail @tests.details
65
+ @logErrors()
66
+ return false
67
+
68
+ hasPassed: ->
69
+ @logSpecs()
70
+ @logStats()
71
+ @pass @tests.details
72
+ @logErrors()
73
+ return true
74
+
75
+ @files.forEach (f) ->
76
+ f.src.filter (filepath) ->
77
+
78
+ unless grunt.file.exists filepath
79
+ grunt.log.warn 'Source file "' + filepath + '" not found.'
80
+ return false
81
+
82
+ else
83
+ new bootcamp.gruntTask bootcamp.test filepath
@@ -0,0 +1,10 @@
1
+ @include describe("Actual") {
2
+ @include it("should return the actual value") {
3
+ $expect: expect(1);
4
+ @include should( expect( actual() ), to( be( 1 )));
5
+
6
+ $expect: expect( false );
7
+ $expect: expect("hello");
8
+ @include should( expect( actual() ), to( be( "hello" )));
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ @include describe("Expect") {
2
+ @include it("should expect something simple") {
3
+ @include should( expect( 1 ), to( be( 1 )));
4
+ @include should( expect( a ), to( be( a )));
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ @include describe("Not to") {
2
+ @include it("should expect not to do something simple") {
3
+ @include should(expect(1), not-to(be(2)));
4
+ }
5
+ }
@@ -0,0 +1,10 @@
1
+ @include describe("Should") {
2
+ @include it("should set the text and value") {
3
+ $when: should("be the correct", "value", true);
4
+ $text: $bc-expect-text;
5
+ $value: $bc-expect;
6
+
7
+ @include should( expect( $text ), to( be("be the correct")));
8
+ @include should( expect( $value ), to( be("value")));
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ @include describe("To") {
2
+ @include it("should expect to do something simple") {
3
+ @include should(expect(1), to(be(1)));
4
+ }
5
+ }
@@ -0,0 +1,11 @@
1
+ @include describe("Describe") {
2
+ @include it("should describe a module") {
3
+ @include should(null, true);
4
+ }
5
+
6
+ @include describe("Describe") {
7
+ @include it("should describe a sub-module") {
8
+ @include should(null, true);
9
+ }
10
+ }
11
+ }