ninjs 0.16.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -2
- data/.gitmodules +0 -0
- data/README.md +5 -7
- data/VERSION +1 -1
- data/lib/ninjs/dependencies.rb +2 -0
- data/lib/ninjs/manifest.rb +1 -1
- data/lib/ninjs/project.rb +25 -12
- data/ninjs.gemspec +31 -24
- data/repository/ninjs/.travis.yml +2 -0
- data/repository/ninjs/Gemfile +4 -0
- data/repository/ninjs/README.md +4 -0
- data/repository/ninjs/Rakefile +18 -0
- data/repository/ninjs/spec/index.html +56 -0
- data/repository/ninjs/spec/javascripts/application_spec.js +21 -0
- data/repository/ninjs/spec/javascripts/array_utility_spec.js +49 -0
- data/repository/ninjs/spec/javascripts/existence_spec.js +71 -0
- data/repository/ninjs/spec/javascripts/extension_spec.js +22 -0
- data/repository/ninjs/spec/javascripts/module_spec.js +30 -0
- data/repository/ninjs/spec/javascripts/string_utility_spec.js +85 -0
- data/repository/ninjs/spec/javascripts/support/jasmine.yml +75 -0
- data/repository/ninjs/spec/javascripts/support/jasmine_config.rb +23 -0
- data/repository/ninjs/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/cli_spec.rb +24 -24
- data/spec/command_spec.rb +13 -13
- data/spec/dependencies_spec.rb +4 -0
- data/spec/manifest_spec.rb +1 -1
- data/spec/project_spec.rb +27 -17
- data/templates/jasmine.yml +74 -0
- data/templates/test-index.html +51 -0
- metadata +21 -14
- data/repository/ninjs/tests/application.test.js +0 -24
- data/repository/ninjs/tests/array.utilities.test.js +0 -55
- data/repository/ninjs/tests/existence.test.js +0 -64
- data/repository/ninjs/tests/extension.test.js +0 -28
- data/repository/ninjs/tests/index.html +0 -26
- data/repository/ninjs/tests/module.test.js +0 -71
- data/repository/ninjs/tests/qspec.js +0 -26
- data/repository/ninjs/tests/string.utilities.test.js +0 -85
- data/spec/testspec_spec.rb +0 -7
@@ -1,26 +0,0 @@
|
|
1
|
-
function QSpec(context) {
|
2
|
-
this.context = context;
|
3
|
-
this.tests = [];
|
4
|
-
this.before = function() {};
|
5
|
-
this.after = function() {};
|
6
|
-
}
|
7
|
-
|
8
|
-
QSpec.prototype.run_all = function() {
|
9
|
-
var slf = this;
|
10
|
-
|
11
|
-
if (this.context !== undefined && typeof this.context === 'string') {
|
12
|
-
module(this.context);
|
13
|
-
}
|
14
|
-
|
15
|
-
var length = this.tests.length;
|
16
|
-
|
17
|
-
for (var i = 0; i < length; i++) {
|
18
|
-
this.before();
|
19
|
-
test(this.tests[i].spec, this.tests[i].assertions);
|
20
|
-
this.after();
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
QSpec.prototype.should = function(spec, assertions) {
|
25
|
-
this.tests.push({ spec: spec, assertions: assertions });
|
26
|
-
};
|
@@ -1,85 +0,0 @@
|
|
1
|
-
var spec = new QSpec("string utility tests");
|
2
|
-
|
3
|
-
spec.should("test for emptiness with is_empty and not_empty", function() {
|
4
|
-
ok(''.is_empty(), "''.is_empty() is true");
|
5
|
-
equals('hey there'.is_empty(), false, "'hey there'.is_empty() is false");
|
6
|
-
ok('hey there'.not_empty(), "'hey there'.not_empty() is false");
|
7
|
-
equals(''.not_empty(), false, "''.not_empty() is false");
|
8
|
-
});
|
9
|
-
|
10
|
-
spec.should('test for numeric value', function() {
|
11
|
-
equals('34'.is_numeric(), true, "34 is numeric");
|
12
|
-
equals('0.5'.is_numeric(), true, ".5 is numeric");
|
13
|
-
equals('-34'.is_numeric(), true, '-34 is numeric');
|
14
|
-
equals('-0.5'.is_numeric(), true, '-.05 is numeric');
|
15
|
-
equals('hello'.is_numeric(), false, 'hello is numeric');
|
16
|
-
});
|
17
|
-
|
18
|
-
spec.should('trim a string with trim, ltrim, and rtrim', function() {
|
19
|
-
equals(' hello '.trim(), 'hello', "' hello '.trim()");
|
20
|
-
equals(' hello '.ltrim(), 'hello ', "' hello '.ltrim()");
|
21
|
-
equals(' hello '.rtrim(), ' hello', "' hello '.rtrim()");
|
22
|
-
});
|
23
|
-
|
24
|
-
spec.should("iterate over each character with each", function() {
|
25
|
-
var iteration_count = 0;
|
26
|
-
var test_chars = [];
|
27
|
-
var test_indices = [];
|
28
|
-
'123'.each(function(character, index) {
|
29
|
-
test_chars.push(character);
|
30
|
-
test_indices.push(index);
|
31
|
-
iteration_count++;
|
32
|
-
});
|
33
|
-
|
34
|
-
equals(test_chars[0], '1', 'first character of 123 is 1');
|
35
|
-
equals(test_chars[1], '2', 'second character of 123 is 2');
|
36
|
-
equals(test_chars[2], '3', 'second character of 123 is 3');
|
37
|
-
|
38
|
-
equals(test_indices[0], 0, 'first index is correct');
|
39
|
-
equals(test_indices[1], 1, 'second index is correct');
|
40
|
-
equals(test_indices[2], 2, 'third index is correct');
|
41
|
-
|
42
|
-
equals(iteration_count, 3, 'made only three iterations');
|
43
|
-
});
|
44
|
-
|
45
|
-
spec.should('capitalize a string with capitalize', function() {
|
46
|
-
equals('hello world'.capitalize(), 'Hello world', 'capitalized string correctly');
|
47
|
-
});
|
48
|
-
|
49
|
-
spec.should('reverse a string with reverse', function() {
|
50
|
-
equals('hello world'.reverse(), 'dlrow olleh', 'reversed string correctly');
|
51
|
-
equals('satan oscillate my metallic sonatas'.reverse(), 'satanos cillatem ym etallicso natas', 'fucking palindromes, how do they work?');
|
52
|
-
});
|
53
|
-
|
54
|
-
spec.should("convert to number", function() {
|
55
|
-
var whole_number = '32';
|
56
|
-
var decimal = '0.08';
|
57
|
-
var negative_number = '-32';
|
58
|
-
var negative_float = '-0.08';
|
59
|
-
|
60
|
-
same(whole_number.to_n(), 32, "whole_number.to_n() is 32");
|
61
|
-
same(decimal.to_n(), 0.08, "decimal.to_n() is 0.08");
|
62
|
-
same(negative_number.to_n(), -32, "negative_number.to_n() is -32");
|
63
|
-
same(negative_float.to_n(), -0.08, "negative_float.to_n() -0.08");
|
64
|
-
});
|
65
|
-
|
66
|
-
spec.should("pluck all instances of a sub-string within a string ", function() {
|
67
|
-
equals('one, two, three'.pluck(','), 'one two three', "'one, two, three'.pluck(',')");
|
68
|
-
});
|
69
|
-
|
70
|
-
spec.should("compress a string to single spaces", function() {
|
71
|
-
var hard_space = 'one two three four five six';
|
72
|
-
var soft_space = 'one two three four five six';
|
73
|
-
var mixed_space = 'one two three four five six';
|
74
|
-
|
75
|
-
equals(hard_space.single_space(), 'one two three four five six', 'correctly spaced ');
|
76
|
-
equals(soft_space.single_space(), 'one two three four five six', "correctly spaced soft spaces");
|
77
|
-
equals(mixed_space.single_space(), 'one two three four five six', "correctly spaced mixed spaces");
|
78
|
-
});
|
79
|
-
|
80
|
-
spec.should("compress a string, removing all whitespace", function() {
|
81
|
-
var string = "satan\n\t oscillate\n\t my\n\t metallic\n sonatas";
|
82
|
-
same(string.compress(), 'satanoscillatemymetallicsonatas', "string is compressed correctly");
|
83
|
-
});
|
84
|
-
|
85
|
-
spec.run_all();
|