ninjs 0.13.8 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/ninjs +2 -1
- data/lib/ninjs/command.rb +1 -1
- data/lib/ninjs/generator.rb +14 -10
- data/lib/ninjs/project.rb +7 -4
- data/ninjs.gemspec +20 -7
- data/repository/ninjs/core/application.js +24 -43
- data/repository/ninjs/core/dom.js +139 -0
- data/repository/ninjs/core/existence.js +121 -277
- data/repository/ninjs/core/extend.js +35 -77
- data/repository/ninjs/core/module.js +101 -116
- data/repository/ninjs/core/nin.js +7 -4
- data/repository/ninjs/tests/application.test.js +24 -0
- data/repository/ninjs/tests/array.utilities.test.js +55 -0
- data/repository/ninjs/tests/existence.test.js +64 -0
- data/repository/ninjs/tests/extension.test.js +38 -0
- data/repository/ninjs/tests/index.html +11 -5
- data/repository/ninjs/tests/module.test.js +75 -0
- data/repository/ninjs/tests/qspec.js +26 -0
- data/repository/ninjs/tests/{ninjs.utilities.test.js → string.utilities.test.js} +14 -66
- data/spec/cli_spec.rb +159 -0
- data/spec/command_spec.rb +226 -2
- data/spec/fixtures/compressed.myapp.js +40 -20
- data/spec/fixtures/myapp.initial.js +383 -488
- data/spec/fixtures/myapp.js +379 -484
- data/spec/fixtures/mymodule.alias.module.js +10 -0
- data/spec/fixtures/mymodule.dependencies.module.js +13 -0
- data/spec/fixtures/mymodule.elements.js +5 -0
- data/spec/fixtures/mymodule.model.js +3 -0
- data/spec/fixtures/mymodule.module.js +10 -0
- data/spec/fixtures/nin.js +428 -0
- data/spec/generator_spec.rb +58 -10
- data/spec/project_spec.rb +11 -7
- metadata +59 -9
- data/repository/ninjs/tests/ninjs.test.js +0 -188
- data/repository/ninjs/tests/qunit/qunit.css +0 -197
- data/repository/ninjs/tests/qunit/qunit.js +0 -1415
@@ -0,0 +1,38 @@
|
|
1
|
+
var spec = new QSpec("Extensions");
|
2
|
+
|
3
|
+
spec.should("add 'method' to the Function prototype", function() {
|
4
|
+
ok(is_defined(Function.prototype.method), "Object.prototype.method is defined");
|
5
|
+
|
6
|
+
String.method('test_method', function() {
|
7
|
+
return 'This is a test';
|
8
|
+
});
|
9
|
+
|
10
|
+
equals('Hello'.test_method(), 'This is a test', 'can create a prototype method with method');
|
11
|
+
});
|
12
|
+
|
13
|
+
spec.should("test a condition with unless", function() {
|
14
|
+
var is_true = false;
|
15
|
+
|
16
|
+
unless (false,
|
17
|
+
function() {
|
18
|
+
is_true = true;
|
19
|
+
}
|
20
|
+
);
|
21
|
+
|
22
|
+
ok(is_true, "unless works");
|
23
|
+
|
24
|
+
var does_fallback_work = false;
|
25
|
+
|
26
|
+
unless (true,
|
27
|
+
function() {
|
28
|
+
|
29
|
+
},
|
30
|
+
function() {
|
31
|
+
does_fallback_work = true;
|
32
|
+
}
|
33
|
+
);
|
34
|
+
|
35
|
+
ok(does_fallback_work, 'fallback works');
|
36
|
+
});
|
37
|
+
|
38
|
+
spec.run_all();
|
@@ -2,16 +2,22 @@
|
|
2
2
|
<head>
|
3
3
|
<title>All Ninjs tests</title>
|
4
4
|
|
5
|
-
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen"/>
|
5
|
+
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen"/>
|
6
6
|
|
7
|
-
|
8
|
-
<script src="
|
7
|
+
|
8
|
+
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
|
9
|
+
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
|
10
|
+
<script src="qspec.js"></script>
|
9
11
|
|
10
12
|
<script src="../lib/nin.js"></script>
|
11
13
|
<script src="../lib/utilities.js"></script>
|
12
14
|
|
13
|
-
<script src="
|
14
|
-
<script src="
|
15
|
+
<script src="existence.test.js"></script>
|
16
|
+
<script src="extension.test.js"></script>
|
17
|
+
<script src="application.test.js"></script>
|
18
|
+
<script src="module.test.js"></script>
|
19
|
+
<script src="string.utilities.test.js"></script>
|
20
|
+
<script src="array.utilities.test.js"></script>
|
15
21
|
</head>
|
16
22
|
<body>
|
17
23
|
<h1 id="qunit-header">Ninjs tests</h1>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
var spec = new QSpec('NinjsModule');
|
2
|
+
|
3
|
+
spec.should('return the module when adding a module', function() {
|
4
|
+
var test_app = new NinjsApplication('myapp');
|
5
|
+
var module = test_app.add_module('mymod');
|
6
|
+
equals(module, test_app.mymod, 'returns the module when adding a module');
|
7
|
+
});
|
8
|
+
|
9
|
+
spec.should("have the correct defaults", function() {
|
10
|
+
var testapp = new NinjsApplication();
|
11
|
+
testapp.add_module('testmodule');
|
12
|
+
|
13
|
+
// properties
|
14
|
+
ok(is_defined(testapp.testmodule.run_tests), 'testapp.testmodule.run_tests is defined');
|
15
|
+
equals(testapp.testmodule.run_tests, false, 'testapp.testmodule.run_tests defaults to false');
|
16
|
+
ok(is_defined(testapp.testmodule.data), "testapp.testmodule.data is defined");
|
17
|
+
ok(is_defined(testapp.testmodule.name), 'testapp.testmodule.name is defined');
|
18
|
+
equals(testapp.testmodule.name, 'testmodule', 'testapp.testmodule.name is correct');
|
19
|
+
ok(is_defined(testapp.testmodule.tests), 'testapp.testmodule.tests is defined');
|
20
|
+
ok(is_array(testapp.testmodule.tests), 'testapp.testmodule.tests is_array');
|
21
|
+
ok(testapp.testmodule.tests.is_empty(), 'testapp.testmodule.tests is empty');
|
22
|
+
|
23
|
+
// methods
|
24
|
+
ok(is_defined(testapp.testmodule.actions), 'testapp.testmodule.actions is defined');
|
25
|
+
ok(is_typeof(Function, testapp.testmodule.actions), "testapp.testmodule.actions is a valid Function");
|
26
|
+
ok(is_defined(testapp.testmodule.run), 'testapp.testmodule.run is defined');
|
27
|
+
ok(is_typeof(Function, testapp.testmodule.run), "testapp.testmodule.run is a valid Function");
|
28
|
+
ok(is_defined(testapp.testmodule.execute), 'testmodule.testapp.execute is defined');
|
29
|
+
ok(is_defined(testapp.testmodule.elements), 'testapp.testmodule.elements is defined');
|
30
|
+
ok(is_defined(testapp.testmodule.set_data), 'testapp.testmodule.set_data is defined');
|
31
|
+
});
|
32
|
+
|
33
|
+
spec.run_all();
|
34
|
+
|
35
|
+
// Qunit waits for DOM to load before running tests
|
36
|
+
// to test DOM wait feature, we need to run some code outside the tests
|
37
|
+
(function() {
|
38
|
+
var spec = new QSpec('NinjsModule');
|
39
|
+
|
40
|
+
var testapp = new NinjsApplication();
|
41
|
+
testapp.add_module('testmodule');
|
42
|
+
testapp.testmodule.actions = function() {
|
43
|
+
// append an element to be sure the DOM is ready for manipulation and test for the element's existence
|
44
|
+
$('body').append('<div id="made-by-actions"/>');
|
45
|
+
|
46
|
+
spec.should("run the module actions", function() {
|
47
|
+
equals($('#made-by-actions').length, 1,'testapp.test.actions ran after DOM was ready');
|
48
|
+
});
|
49
|
+
|
50
|
+
spec.run_all();
|
51
|
+
};
|
52
|
+
|
53
|
+
testapp.testmodule.run();
|
54
|
+
}());
|
55
|
+
|
56
|
+
// Qunit waits for DOM to load before running tests
|
57
|
+
// to test DOM wait feature, we need to run some code outside the tests
|
58
|
+
(function() {
|
59
|
+
spec.should('set elements', function() {
|
60
|
+
this.app = new NinjsApplication('myapp');
|
61
|
+
var mod = this.app.add_module('mymod');
|
62
|
+
|
63
|
+
|
64
|
+
mod.dom.ready(function() {
|
65
|
+
mod.elements({
|
66
|
+
body: $('body')
|
67
|
+
});
|
68
|
+
|
69
|
+
equals(mod.elements('body').length, 1, 'mod.elements("body") has length of 1');
|
70
|
+
equals(mod.elements('body').text(), $('body').text(), 'mod.elements("body").text() = $("body").text()');
|
71
|
+
});
|
72
|
+
});
|
73
|
+
|
74
|
+
spec.run_all();
|
75
|
+
}());
|
@@ -0,0 +1,26 @@
|
|
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,67 +1,13 @@
|
|
1
|
-
|
1
|
+
var spec = new QSpec("string utility tests");
|
2
2
|
|
3
|
-
|
4
|
-
expect(4);
|
5
|
-
|
6
|
-
ok([].is_empty(), "[].is_empty() is true");
|
7
|
-
equals(['one', 'two', 'three'].is_empty(), false, "['one', 'two', 'three'].is_empty()");
|
8
|
-
ok(['one', 'two', 'three'].not_empty(), "['one', 'two', 'three'].not_empty() is false");
|
9
|
-
equals([].not_empty(), false, "[].not_empty() is false");
|
10
|
-
});
|
11
|
-
|
12
|
-
test("can iterate over each element", function() {
|
13
|
-
expect(7);
|
14
|
-
|
15
|
-
var iteration_count = 0;
|
16
|
-
var test_array_values = [];
|
17
|
-
var test_array_indices = [];
|
18
|
-
|
19
|
-
['one', 'two', 'three'].each(function(value, index) {
|
20
|
-
iteration_count++;
|
21
|
-
test_array_values.push(value);
|
22
|
-
test_array_indices.push(index);
|
23
|
-
});
|
24
|
-
|
25
|
-
equals(test_array_values[0], 'one', 'value at index 0 is correct');
|
26
|
-
equals(test_array_values[1], 'two', 'value at index 1 is correct');
|
27
|
-
equals(test_array_values[2], 'three', 'value at index 2 is correct');
|
28
|
-
|
29
|
-
equals(test_array_indices[0], 0, 'first index is correct');
|
30
|
-
equals(test_array_indices[1], 1, 'second index is correct');
|
31
|
-
equals(test_array_indices[2], 2, 'third index is correct');
|
32
|
-
|
33
|
-
equals(iteration_count, 3, 'made only three iterations');
|
34
|
-
});
|
35
|
-
|
36
|
-
test("can test if an array contains an element", function() {
|
37
|
-
var array = ['one', 'two', 'three'];
|
38
|
-
var string = 'hello';
|
39
|
-
var object = {
|
40
|
-
name: 'some object'
|
41
|
-
};
|
42
|
-
var number = 45;
|
43
|
-
var date = new Date();
|
44
|
-
|
45
|
-
var test_array = [array, string, object, number, date];
|
46
|
-
|
47
|
-
ok(test_array.contains(array), 'array.contains(array)');
|
48
|
-
ok(test_array.contains(string), 'array.contains(string)');
|
49
|
-
ok(test_array.contains(object), 'array.contains(object)');
|
50
|
-
ok(test_array.contains(number), 'array.contains(number)');
|
51
|
-
ok(test_array.contains(date), 'array.contains(date)');
|
52
|
-
equals(test_array.contains('not in there'), false, 'non-existent value is false');
|
53
|
-
});
|
54
|
-
|
55
|
-
module("string utility tests");
|
56
|
-
|
57
|
-
test("can test for emptiness", function() {
|
3
|
+
spec.should("test for emptiness with is_empty and not_empty", function() {
|
58
4
|
ok(''.is_empty(), "''.is_empty() is true");
|
59
5
|
equals('hey there'.is_empty(), false, "'hey there'.is_empty() is false");
|
60
6
|
ok('hey there'.not_empty(), "'hey there'.not_empty() is false");
|
61
7
|
equals(''.not_empty(), false, "''.not_empty() is false");
|
62
8
|
});
|
63
9
|
|
64
|
-
|
10
|
+
spec.should('test for numeric value', function() {
|
65
11
|
equals('34'.is_numeric(), true, "34 is numeric");
|
66
12
|
equals('0.5'.is_numeric(), true, ".5 is numeric");
|
67
13
|
equals('-34'.is_numeric(), true, '-34 is numeric');
|
@@ -69,13 +15,13 @@ test('can test for number', function() {
|
|
69
15
|
equals('hello'.is_numeric(), false, 'hello is numeric');
|
70
16
|
});
|
71
17
|
|
72
|
-
|
18
|
+
spec.should('trim a string with trim, ltrim, and rtrim', function() {
|
73
19
|
equals(' hello '.trim(), 'hello', "' hello '.trim()");
|
74
20
|
equals(' hello '.ltrim(), 'hello ', "' hello '.ltrim()");
|
75
21
|
equals(' hello '.rtrim(), ' hello', "' hello '.rtrim()");
|
76
22
|
});
|
77
23
|
|
78
|
-
|
24
|
+
spec.should("iterate over each character with each", function() {
|
79
25
|
var iteration_count = 0;
|
80
26
|
var test_chars = [];
|
81
27
|
var test_indices = [];
|
@@ -96,16 +42,16 @@ test("can iterate over each character", function() {
|
|
96
42
|
equals(iteration_count, 3, 'made only three iterations');
|
97
43
|
});
|
98
44
|
|
99
|
-
|
45
|
+
spec.should('capitalize a string with capitalize', function() {
|
100
46
|
equals('hello world'.capitalize(), 'Hello world', 'capitalized string correctly');
|
101
47
|
});
|
102
48
|
|
103
|
-
|
49
|
+
spec.should('reverse a string with reverse', function() {
|
104
50
|
equals('hello world'.reverse(), 'dlrow olleh', 'reversed string correctly');
|
105
51
|
equals('satan oscillate my metallic sonatas'.reverse(), 'satanos cillatem ym etallicso natas', 'fucking palindromes, how do they work?');
|
106
52
|
});
|
107
53
|
|
108
|
-
|
54
|
+
spec.should("convert to number", function() {
|
109
55
|
var whole_number = '32';
|
110
56
|
var decimal = '0.08';
|
111
57
|
var negative_number = '-32';
|
@@ -117,11 +63,11 @@ test("can convert to number", function() {
|
|
117
63
|
same(negative_float.to_n(), -0.08, "negative_float.to_n() -0.08");
|
118
64
|
});
|
119
65
|
|
120
|
-
|
66
|
+
spec.should("pluck all instances of a sub-string within a string ", function() {
|
121
67
|
equals('one, two, three'.pluck(','), 'one two three', "'one, two, three'.pluck(',')");
|
122
68
|
});
|
123
69
|
|
124
|
-
|
70
|
+
spec.should("compress a string to single spaces", function() {
|
125
71
|
var hard_space = 'one two three four five six';
|
126
72
|
var soft_space = 'one two three four five six';
|
127
73
|
var mixed_space = 'one two three four five six';
|
@@ -131,7 +77,9 @@ test("can single space a string", function() {
|
|
131
77
|
equals(mixed_space.single_space(), 'one two three four five six', "correctly spaced mixed spaces");
|
132
78
|
});
|
133
79
|
|
134
|
-
|
80
|
+
spec.should("compress a string, removing all whitespace", function() {
|
135
81
|
var string = "satan\n\t oscillate\n\t my\n\t metallic\n sonatas";
|
136
82
|
same(string.compress(), 'satanoscillatemymetallicsonatas', "string is compressed correctly");
|
137
|
-
});
|
83
|
+
});
|
84
|
+
|
85
|
+
spec.run_all();
|
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'CLI' do
|
4
|
+
before :each do
|
5
|
+
@bin = "#{File.expand_path('../bin')}/ninjs"
|
6
|
+
end
|
7
|
+
|
8
|
+
after :each do
|
9
|
+
FileUtils.rm_rf 'application'
|
10
|
+
FileUtils.rm_rf 'modules'
|
11
|
+
FileUtils.rm_rf 'elements'
|
12
|
+
FileUtils.rm_rf 'models'
|
13
|
+
FileUtils.rm_rf 'lib'
|
14
|
+
FileUtils.rm_rf 'plugins'
|
15
|
+
FileUtils.rm_rf 'tests'
|
16
|
+
FileUtils.rm_rf 'ninjs.conf'
|
17
|
+
FileUtils.rm_rf 'js' if File.exists? 'js'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should create a new application' do
|
21
|
+
suppress_output { `#{@bin} create myapp` }
|
22
|
+
|
23
|
+
'ninjs.conf'.should be_same_file_as 'fixtures/ninjs.conf'
|
24
|
+
|
25
|
+
File.directory?("application").should be_true
|
26
|
+
File.directory?("elements").should be_true
|
27
|
+
File.directory?("lib").should be_true
|
28
|
+
File.directory?("models").should be_true
|
29
|
+
File.directory?("modules").should be_true
|
30
|
+
File.directory?("plugins").should be_true
|
31
|
+
File.directory?("tests").should be_true
|
32
|
+
|
33
|
+
File.exists?(File.expand_path("lib/nin.js")).should be_true
|
34
|
+
File.exists?(File.expand_path("lib/utilities.js")).should be_true
|
35
|
+
|
36
|
+
File.exists?(File.expand_path("application/myapp.js")).should be_true
|
37
|
+
application_file_content = File.open("application/myapp.js").readlines
|
38
|
+
application_file_content.shift
|
39
|
+
application_file_content.join('').should == File.open('fixtures/myapp.initial.js').readlines.join('')
|
40
|
+
|
41
|
+
File.exists?(File.expand_path("tests")).should be_true
|
42
|
+
File.exists?(File.expand_path("tests/index.html")).should be_true
|
43
|
+
File.exists?(File.expand_path("tests/application.test.js")).should be_true
|
44
|
+
File.exists?(File.expand_path("tests/array.utilities.test.js")).should be_true
|
45
|
+
File.exists?(File.expand_path("tests/existence.test.js")).should be_true
|
46
|
+
File.exists?(File.expand_path("tests/extension.test.js")).should be_true
|
47
|
+
File.exists?(File.expand_path("tests/module.test.js")).should be_true
|
48
|
+
File.exists?(File.expand_path("tests/qspec.js")).should be_true
|
49
|
+
File.exists?(File.expand_path("tests/string.utilities.test.js")).should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should create a new application in a subdirectory' do
|
53
|
+
suppress_output { `#{@bin} create myapp js` }
|
54
|
+
|
55
|
+
'js/ninjs.conf'.should be_same_file_as 'fixtures/ninjs.conf'
|
56
|
+
|
57
|
+
File.directory?("js/application").should be_true
|
58
|
+
File.directory?("js/elements").should be_true
|
59
|
+
File.directory?("js/lib").should be_true
|
60
|
+
File.directory?("js/models").should be_true
|
61
|
+
File.directory?("js/modules").should be_true
|
62
|
+
File.directory?("js/plugins").should be_true
|
63
|
+
File.directory?("js/tests").should be_true
|
64
|
+
|
65
|
+
File.exists?(File.expand_path("js/lib/nin.js")).should be_true
|
66
|
+
File.exists?(File.expand_path("js/lib/utilities.js")).should be_true
|
67
|
+
|
68
|
+
File.exists?(File.expand_path("js/application/myapp.js")).should be_true
|
69
|
+
application_file_content = File.open("js/application/myapp.js").readlines
|
70
|
+
application_file_content.shift
|
71
|
+
application_file_content.join('').should == File.open('fixtures/myapp.initial.js').readlines.join('')
|
72
|
+
|
73
|
+
File.exists?(File.expand_path("js/tests")).should be_true
|
74
|
+
File.exists?(File.expand_path("js/tests/index.html")).should be_true
|
75
|
+
File.exists?(File.expand_path("js/tests/application.test.js")).should be_true
|
76
|
+
File.exists?(File.expand_path("js/tests/array.utilities.test.js")).should be_true
|
77
|
+
File.exists?(File.expand_path("js/tests/existence.test.js")).should be_true
|
78
|
+
File.exists?(File.expand_path("js/tests/extension.test.js")).should be_true
|
79
|
+
File.exists?(File.expand_path("js/tests/module.test.js")).should be_true
|
80
|
+
File.exists?(File.expand_path("js/tests/qspec.js")).should be_true
|
81
|
+
File.exists?(File.expand_path("js/tests/string.utilities.test.js")).should be_true
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should compile the application' do
|
85
|
+
suppress_output { `#{@bin} create myapp` }
|
86
|
+
|
87
|
+
FileUtils.cp 'fixtures/hello.module.js', File.expand_path('modules')
|
88
|
+
FileUtils.cp 'fixtures/hello.elements.js', File.expand_path('elements')
|
89
|
+
FileUtils.cp 'fixtures/hello.model.js', File.expand_path('models')
|
90
|
+
FileUtils.cp 'fixtures/foo.module.js', File.expand_path('modules')
|
91
|
+
FileUtils.cp 'fixtures/foo.elements.js', File.expand_path('elements')
|
92
|
+
FileUtils.cp 'fixtures/foo.model.js', File.expand_path('models')
|
93
|
+
|
94
|
+
suppress_output { `#{@bin} compile` }
|
95
|
+
|
96
|
+
File.exists?('application/hello.js').should be_true
|
97
|
+
File.exists?('application/foo.js').should be_true
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should update the application' do
|
101
|
+
suppress_output { `#{@bin} create myapp` }
|
102
|
+
|
103
|
+
File.open('lib/nin.js', 'w+') do |file|
|
104
|
+
file << 'changed'
|
105
|
+
end
|
106
|
+
|
107
|
+
suppress_output { `#{@bin} update` }
|
108
|
+
|
109
|
+
'lib/nin.js'.should be_same_file_as 'fixtures/nin.js'
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should generate a module file' do
|
113
|
+
suppress_output do
|
114
|
+
`#{@bin} create myapp`
|
115
|
+
`#{@bin} generate module mymodule`
|
116
|
+
end
|
117
|
+
|
118
|
+
'modules/mymodule.module.js'.should be_same_file_as 'fixtures/mymodule.module.js'
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should generate a module file with an alias' do
|
122
|
+
suppress_output do
|
123
|
+
`#{@bin} create myapp`
|
124
|
+
`#{@bin} generate module mymodule -a`
|
125
|
+
end
|
126
|
+
|
127
|
+
'modules/mymodule.module.js'.should be_same_file_as 'fixtures/mymodule.alias.module.js'
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should generate an elements file' do
|
131
|
+
suppress_output do
|
132
|
+
`#{@bin} create myapp`
|
133
|
+
`#{@bin} generate elements mymodule`
|
134
|
+
end
|
135
|
+
|
136
|
+
'elements/mymodule.elements.js'.should be_same_file_as 'fixtures/mymodule.elements.js'
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should generate a model file' do
|
140
|
+
suppress_output do
|
141
|
+
`#{@bin} create myapp`
|
142
|
+
`#{@bin} generate model mymodule`
|
143
|
+
end
|
144
|
+
|
145
|
+
'models/mymodule.model.js'.should be_same_file_as 'fixtures/mymodule.model.js'
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'should generate a module file with dependencies' do
|
149
|
+
suppress_output do
|
150
|
+
`#{@bin} create myapp`
|
151
|
+
`#{@bin} generate module mymodule -em`
|
152
|
+
end
|
153
|
+
|
154
|
+
'modules/mymodule.module.js'.should be_same_file_as 'fixtures/mymodule.dependencies.module.js'
|
155
|
+
'elements/mymodule.elements.js'.should be_same_file_as 'fixtures/mymodule.elements.js'
|
156
|
+
'models/mymodule.model.js'.should be_same_file_as 'fixtures/mymodule.model.js'
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|