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
@@ -0,0 +1,22 @@
|
|
1
|
+
describe("Extensions", function() {
|
2
|
+
it("should test a negated conditional with unless", function() {
|
3
|
+
var is_true = false,
|
4
|
+
does_fallback_work = false;
|
5
|
+
|
6
|
+
unless (false,
|
7
|
+
function() {
|
8
|
+
is_true = true;
|
9
|
+
}
|
10
|
+
);
|
11
|
+
|
12
|
+
unless (true,
|
13
|
+
function() {},
|
14
|
+
function() {
|
15
|
+
does_fallback_work = true;
|
16
|
+
}
|
17
|
+
);
|
18
|
+
|
19
|
+
expect(is_true).toBeTruthy();
|
20
|
+
expect(does_fallback_work).toBeTruthy();
|
21
|
+
});
|
22
|
+
});
|
@@ -0,0 +1,30 @@
|
|
1
|
+
describe("NinjsModule", function() {
|
2
|
+
|
3
|
+
var app;
|
4
|
+
|
5
|
+
beforeEach(function() {
|
6
|
+
app = new NinjsApplication('myapp');
|
7
|
+
});
|
8
|
+
|
9
|
+
it("should return the module when added", function() {
|
10
|
+
var module = app.add_module('mymod');
|
11
|
+
expect(module).toEqual(app.mymod);
|
12
|
+
});
|
13
|
+
|
14
|
+
it("should have the correct default values", function() {
|
15
|
+
app.add_module('testmodule');
|
16
|
+
// properties
|
17
|
+
expect(is_defined(app.testmodule.data)).toBeTruthy();
|
18
|
+
expect(is_defined(app.testmodule.name)).toBeTruthy();
|
19
|
+
expect(app.testmodule.name).toEqual('testmodule');
|
20
|
+
|
21
|
+
// methods
|
22
|
+
expect(is_defined(app.testmodule.actions)).toBeTruthy();
|
23
|
+
expect(is_typeof(Function, app.testmodule.actions)).toBeTruthy();
|
24
|
+
expect(is_defined(app.testmodule.run)).toBeTruthy();
|
25
|
+
expect(is_typeof(Function, app.testmodule.run)).toBeTruthy();
|
26
|
+
expect(is_defined(app.testmodule.execute)).toBeTruthy();
|
27
|
+
expect(is_defined(app.testmodule.elements)).toBeTruthy();
|
28
|
+
expect(is_defined(app.testmodule.set_data)).toBeTruthy();
|
29
|
+
});
|
30
|
+
});
|
@@ -0,0 +1,85 @@
|
|
1
|
+
describe("String utility tests", function() {
|
2
|
+
|
3
|
+
it("should test for emptiness with is_empty and not_empty", function() {
|
4
|
+
expect(''.is_empty()).toBeTruthy();
|
5
|
+
expect('hey there'.is_empty()).toBeFalsy();
|
6
|
+
expect('hey there'.not_empty()).toBeTruthy();
|
7
|
+
expect(''.not_empty()).toBeFalsy();
|
8
|
+
});
|
9
|
+
|
10
|
+
it("should test for a numeric value", function() {
|
11
|
+
expect('34'.is_numeric()).toBeTruthy();
|
12
|
+
expect('0.5'.is_numeric()).toBeTruthy();
|
13
|
+
expect('-34'.is_numeric()).toBeTruthy();
|
14
|
+
expect('-0.5'.is_numeric()).toBeTruthy();
|
15
|
+
expect('hello'.is_numeric()).toBeFalsy();
|
16
|
+
});
|
17
|
+
|
18
|
+
it("should trim a string with trim, ltrim, and rtrim", function() {
|
19
|
+
expect(' hello '.trim()).toEqual('hello');
|
20
|
+
expect(' hello '.ltrim()).toEqual('hello ');
|
21
|
+
expect(' hello '.rtrim()).toEqual(' hello');
|
22
|
+
});
|
23
|
+
|
24
|
+
it("should iterate over each character with each", function() {
|
25
|
+
var iteration_count = 0,
|
26
|
+
test_chars = [],
|
27
|
+
test_indices = [];
|
28
|
+
|
29
|
+
'123'.each(function(character, index) {
|
30
|
+
test_chars.push(character);
|
31
|
+
test_indices.push(index);
|
32
|
+
iteration_count++;
|
33
|
+
});
|
34
|
+
|
35
|
+
expect(test_chars[0]).toEqual('1');
|
36
|
+
expect(test_chars[1]).toEqual('2');
|
37
|
+
expect(test_chars[2]).toEqual('3');
|
38
|
+
|
39
|
+
expect(test_indices[0]).toEqual(0);
|
40
|
+
expect(test_indices[1]).toEqual(1);
|
41
|
+
expect(test_indices[2]).toEqual(2);
|
42
|
+
|
43
|
+
expect(iteration_count).toEqual(3);
|
44
|
+
});
|
45
|
+
|
46
|
+
it("should capitalize a String with capitalize", function() {
|
47
|
+
expect('hello world'.capitalize()).toEqual('Hello world');
|
48
|
+
});
|
49
|
+
|
50
|
+
it("should reverse a string with reverse", function() {
|
51
|
+
expect('hello world'.reverse()).toEqual('dlrow olleh');
|
52
|
+
expect('satan oscillate my metallic sonatas'.reverse()).toEqual('satanos cillatem ym etallicso natas');
|
53
|
+
});
|
54
|
+
|
55
|
+
it("should convert to a number", function() {
|
56
|
+
var whole_number = '32',
|
57
|
+
decimal = '0.08',
|
58
|
+
negative_number = '-32',
|
59
|
+
negative_float = '-0.08';
|
60
|
+
|
61
|
+
expect(whole_number.to_n()).toBe(32);
|
62
|
+
expect(decimal.to_n()).toBe(0.08);
|
63
|
+
expect(negative_number.to_n()).toBe(-32);
|
64
|
+
expect(negative_float.to_n()).toBe(-0.08);
|
65
|
+
});
|
66
|
+
|
67
|
+
it("should pluck all instances of a sup-string within a string", function() {
|
68
|
+
expect('one, two, three'.pluck(',')).toEqual('one two three');
|
69
|
+
});
|
70
|
+
|
71
|
+
it("should compress a string to single spaces", function() {
|
72
|
+
var hard_space = 'one two three four five six',
|
73
|
+
soft_space = 'one two three four five six',
|
74
|
+
mixed_space = 'one two three four five six';
|
75
|
+
|
76
|
+
expect(hard_space.single_space()).toBe('one two three four five six');
|
77
|
+
expect(soft_space.single_space()).toBe('one two three four five six');
|
78
|
+
expect(mixed_space.single_space()).toBe('one two three four five six');
|
79
|
+
});
|
80
|
+
|
81
|
+
it("should compress a string, removing all whitespace", function() {
|
82
|
+
var string = "satan\n\t oscillate\n\t my\n\t metallic\n sonatas";
|
83
|
+
expect(string.compress()).toBe('satanoscillatemymetallicsonatas');
|
84
|
+
});
|
85
|
+
});
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- core/*.js
|
15
|
+
- extensions/*.js
|
16
|
+
- utilities/*.js
|
17
|
+
|
18
|
+
# stylesheets
|
19
|
+
#
|
20
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
21
|
+
# Default: []
|
22
|
+
#
|
23
|
+
# EXAMPLE:
|
24
|
+
#
|
25
|
+
# stylesheets:
|
26
|
+
# - css/style.css
|
27
|
+
# - stylesheets/*.css
|
28
|
+
#
|
29
|
+
stylesheets:
|
30
|
+
|
31
|
+
# helpers
|
32
|
+
#
|
33
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
34
|
+
# Default: ["helpers/**/*.js"]
|
35
|
+
#
|
36
|
+
# EXAMPLE:
|
37
|
+
#
|
38
|
+
# helpers:
|
39
|
+
# - helpers/**/*.js
|
40
|
+
#
|
41
|
+
helpers:
|
42
|
+
|
43
|
+
# spec_files
|
44
|
+
#
|
45
|
+
# Return an array of filepaths relative to spec_dir to include.
|
46
|
+
# Default: ["**/*[sS]pec.js"]
|
47
|
+
#
|
48
|
+
# EXAMPLE:
|
49
|
+
#
|
50
|
+
# spec_files:
|
51
|
+
# - **/*[sS]pec.js
|
52
|
+
#
|
53
|
+
spec_files:
|
54
|
+
|
55
|
+
# src_dir
|
56
|
+
#
|
57
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
58
|
+
# Default: project root
|
59
|
+
#
|
60
|
+
# EXAMPLE:
|
61
|
+
#
|
62
|
+
# src_dir: public
|
63
|
+
#
|
64
|
+
src_dir:
|
65
|
+
|
66
|
+
# spec_dir
|
67
|
+
#
|
68
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
69
|
+
# Default: spec/javascripts
|
70
|
+
#
|
71
|
+
# EXAMPLE:
|
72
|
+
#
|
73
|
+
# spec_dir: spec/javascripts
|
74
|
+
#
|
75
|
+
spec_dir:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Jasmine
|
2
|
+
class Config
|
3
|
+
|
4
|
+
# Add your overrides or custom config code here
|
5
|
+
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# Note - this is necessary for rspec2, which has removed the backtrace
|
11
|
+
module Jasmine
|
12
|
+
class SpecBuilder
|
13
|
+
def declare_spec(parent, spec)
|
14
|
+
me = self
|
15
|
+
example_name = spec["name"]
|
16
|
+
@spec_ids << spec["id"]
|
17
|
+
backtrace = @example_locations[parent.description + " " + example_name]
|
18
|
+
parent.it example_name, {} do
|
19
|
+
me.report_spec(spec["id"])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'jasmine'
|
5
|
+
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
|
6
|
+
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
|
7
|
+
if Jasmine::rspec2?
|
8
|
+
require 'rspec'
|
9
|
+
else
|
10
|
+
require 'spec'
|
11
|
+
end
|
12
|
+
|
13
|
+
jasmine_config = Jasmine::Config.new
|
14
|
+
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
15
|
+
|
16
|
+
should_stop = false
|
17
|
+
|
18
|
+
if Jasmine::rspec2?
|
19
|
+
RSpec.configuration.after(:suite) do
|
20
|
+
spec_builder.stop if should_stop
|
21
|
+
end
|
22
|
+
else
|
23
|
+
Spec::Runner.configure do |config|
|
24
|
+
config.after(:suite) do
|
25
|
+
spec_builder.stop if should_stop
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
spec_builder.start
|
31
|
+
should_stop = true
|
32
|
+
spec_builder.declare_suites
|
data/spec/cli_spec.rb
CHANGED
@@ -30,7 +30,18 @@ describe 'CLI' do
|
|
30
30
|
File.directory?("#{SPEC_DIR}/models").should be_true
|
31
31
|
File.directory?("#{SPEC_DIR}/modules").should be_true
|
32
32
|
File.directory?("#{SPEC_DIR}/plugins").should be_true
|
33
|
-
File.directory?("#{SPEC_DIR}/
|
33
|
+
File.directory?("#{SPEC_DIR}/spec").should be_true
|
34
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts").should be_true
|
35
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts/support").should be_true
|
36
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/application_spec.js").should be_true
|
37
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/array_utility_spec.js").should be_true
|
38
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/existence_spec.js").should be_true
|
39
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/extension_spec.js").should be_true
|
40
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/module_spec.js").should be_true
|
41
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/string_utility_spec.js").should be_true
|
42
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine.yml").should be_true
|
43
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_config.rb").should be_true
|
44
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_runner.rb").should be_true
|
34
45
|
|
35
46
|
File.exists?("#{SPEC_DIR}/lib/nin.js").should be_true
|
36
47
|
File.exists?("#{SPEC_DIR}/lib/utilities.js").should be_true
|
@@ -39,16 +50,6 @@ describe 'CLI' do
|
|
39
50
|
application_file_content = File.open("#{SPEC_DIR}/application/myapp.js").readlines
|
40
51
|
application_file_content.shift
|
41
52
|
application_file_content.join('').should == File.open("#{SPEC_DIR}/fixtures/myapp.initial.js").readlines.join('')
|
42
|
-
|
43
|
-
File.exists?("#{SPEC_DIR}/tests").should be_true
|
44
|
-
File.exists?("#{SPEC_DIR}/tests/index.html").should be_true
|
45
|
-
File.exists?("#{SPEC_DIR}/tests/application.test.js").should be_true
|
46
|
-
File.exists?("#{SPEC_DIR}/tests/array.utilities.test.js").should be_true
|
47
|
-
File.exists?("#{SPEC_DIR}/tests/existence.test.js").should be_true
|
48
|
-
File.exists?("#{SPEC_DIR}/tests/extension.test.js").should be_true
|
49
|
-
File.exists?("#{SPEC_DIR}/tests/module.test.js").should be_true
|
50
|
-
File.exists?("#{SPEC_DIR}/tests/qspec.js").should be_true
|
51
|
-
File.exists?("#{SPEC_DIR}/tests/string.utilities.test.js").should be_true
|
52
53
|
end
|
53
54
|
|
54
55
|
it 'should create a new application in a subdirectory' do
|
@@ -62,25 +63,24 @@ describe 'CLI' do
|
|
62
63
|
File.directory?("#{SPEC_DIR}/js/models").should be_true
|
63
64
|
File.directory?("#{SPEC_DIR}/js/modules").should be_true
|
64
65
|
File.directory?("#{SPEC_DIR}/js/plugins").should be_true
|
65
|
-
File.directory?("#{SPEC_DIR}/
|
66
|
-
|
66
|
+
File.directory?("#{SPEC_DIR}/spec").should be_true
|
67
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts").should be_true
|
68
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts/support").should be_true
|
69
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/application_spec.js").should be_true
|
70
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/array_utility_spec.js").should be_true
|
71
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/existence_spec.js").should be_true
|
72
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/extension_spec.js").should be_true
|
73
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/module_spec.js").should be_true
|
74
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/string_utility_spec.js").should be_true
|
75
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine.yml").should be_true
|
76
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_config.rb").should be_true
|
77
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_runner.rb").should be_true
|
67
78
|
File.exists?("#{SPEC_DIR}/js/lib/nin.js").should be_true
|
68
79
|
File.exists?("#{SPEC_DIR}/js/lib/utilities.js").should be_true
|
69
|
-
|
70
80
|
File.exists?("#{SPEC_DIR}/js/application/myapp.js").should be_true
|
71
81
|
application_file_content = File.open("#{SPEC_DIR}/js/application/myapp.js").readlines
|
72
82
|
application_file_content.shift
|
73
83
|
application_file_content.join('').should == File.open("#{SPEC_DIR}/fixtures/myapp.initial.js").readlines.join('')
|
74
|
-
|
75
|
-
File.exists?("#{SPEC_DIR}/js/tests").should be_true
|
76
|
-
File.exists?("#{SPEC_DIR}/js/tests/index.html").should be_true
|
77
|
-
File.exists?("#{SPEC_DIR}/js/tests/application.test.js").should be_true
|
78
|
-
File.exists?("#{SPEC_DIR}/js/tests/array.utilities.test.js").should be_true
|
79
|
-
File.exists?("#{SPEC_DIR}/js/tests/existence.test.js").should be_true
|
80
|
-
File.exists?("#{SPEC_DIR}/js/tests/extension.test.js").should be_true
|
81
|
-
File.exists?("#{SPEC_DIR}/js/tests/module.test.js").should be_true
|
82
|
-
File.exists?("#{SPEC_DIR}/js/tests/qspec.js").should be_true
|
83
|
-
File.exists?("#{SPEC_DIR}/js/tests/string.utilities.test.js").should be_true
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'should compile the application' do
|
data/spec/command_spec.rb
CHANGED
@@ -66,25 +66,25 @@ describe Ninjs::Command do
|
|
66
66
|
File.directory?("#{SPEC_DIR}/models").should be_true
|
67
67
|
File.directory?("#{SPEC_DIR}/modules").should be_true
|
68
68
|
File.directory?("#{SPEC_DIR}/plugins").should be_true
|
69
|
-
File.directory?("#{SPEC_DIR}/
|
70
|
-
|
69
|
+
File.directory?("#{SPEC_DIR}/spec").should be_true
|
70
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts").should be_true
|
71
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts/support").should be_true
|
72
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/application_spec.js").should be_true
|
73
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/array_utility_spec.js").should be_true
|
74
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/existence_spec.js").should be_true
|
75
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/extension_spec.js").should be_true
|
76
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/module_spec.js").should be_true
|
77
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/string_utility_spec.js").should be_true
|
78
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine.yml").should be_true
|
79
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_config.rb").should be_true
|
80
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_runner.rb").should be_true
|
81
|
+
|
71
82
|
File.exists?("#{SPEC_DIR}/lib/nin.js").should be_true
|
72
83
|
File.exists?("#{SPEC_DIR}/lib/utilities.js").should be_true
|
73
|
-
|
74
84
|
File.exists?("#{SPEC_DIR}/application/myapp.js").should be_true
|
75
85
|
application_file_content = File.open("#{SPEC_DIR}/application/myapp.js").readlines
|
76
86
|
application_file_content.shift
|
77
87
|
application_file_content.join('').should == File.open("#{SPEC_DIR}/fixtures/myapp.initial.js").readlines.join('')
|
78
|
-
|
79
|
-
File.exists?("#{SPEC_DIR}/tests").should be_true
|
80
|
-
File.exists?("#{SPEC_DIR}/tests/index.html").should be_true
|
81
|
-
File.exists?("#{SPEC_DIR}/tests/application.test.js").should be_true
|
82
|
-
File.exists?("#{SPEC_DIR}/tests/array.utilities.test.js").should be_true
|
83
|
-
File.exists?("#{SPEC_DIR}/tests/existence.test.js").should be_true
|
84
|
-
File.exists?("#{SPEC_DIR}/tests/extension.test.js").should be_true
|
85
|
-
File.exists?("#{SPEC_DIR}/tests/module.test.js").should be_true
|
86
|
-
File.exists?("#{SPEC_DIR}/tests/qspec.js").should be_true
|
87
|
-
File.exists?("#{SPEC_DIR}/tests/string.utilities.test.js").should be_true
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'should compile the application' do
|
data/spec/dependencies_spec.rb
CHANGED
data/spec/manifest_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Ninjs::Manifest do
|
4
4
|
it 'should conatin the correct driectories' do
|
5
|
-
directories = %w(application elements lib models modules plugins
|
5
|
+
directories = %w(application elements lib models modules plugins spec spec/javascripts spec/javascripts/support)
|
6
6
|
Ninjs::Manifest.directories.should === directories
|
7
7
|
end
|
8
8
|
end
|
data/spec/project_spec.rb
CHANGED
@@ -84,7 +84,8 @@ describe Ninjs::Project do
|
|
84
84
|
FileUtils.rm_rf "#{SPEC_DIR}/models"
|
85
85
|
FileUtils.rm_rf "#{SPEC_DIR}/modules"
|
86
86
|
FileUtils.rm_rf "#{SPEC_DIR}/plugins"
|
87
|
-
FileUtils.rm_rf "#{SPEC_DIR}/
|
87
|
+
FileUtils.rm_rf "#{SPEC_DIR}/spec"
|
88
|
+
FileUtils.rm_rf "#{SPEC_DIR}/Rakefile"
|
88
89
|
end
|
89
90
|
|
90
91
|
it 'should create a project directory structure' do
|
@@ -94,7 +95,7 @@ describe Ninjs::Project do
|
|
94
95
|
File.directory?("#{SPEC_DIR}/models").should be_true
|
95
96
|
File.directory?("#{SPEC_DIR}/modules").should be_true
|
96
97
|
File.directory?("#{SPEC_DIR}/plugins").should be_true
|
97
|
-
File.directory?("#{SPEC_DIR}/
|
98
|
+
File.directory?("#{SPEC_DIR}/spec").should be_true
|
98
99
|
end
|
99
100
|
|
100
101
|
it 'should create a ninjs lib file' do
|
@@ -120,19 +121,28 @@ describe Ninjs::Project do
|
|
120
121
|
application_file_content.join('').should == File.open("#{SPEC_DIR}/fixtures/myapp.initial.js").readlines.join('')
|
121
122
|
end
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
124
|
+
it 'should import spec files' do
|
125
|
+
suppress_output { @project.import_spec_files }
|
126
|
+
|
127
|
+
File.directory?("#{SPEC_DIR}/spec").should be_true
|
128
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts").should be_true
|
129
|
+
File.directory?("#{SPEC_DIR}/spec/javascripts/support").should be_true
|
130
|
+
File.exists?("#{SPEC_DIR}/spec/index.html").should be_true
|
131
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/application_spec.js").should be_true
|
132
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/array_utility_spec.js").should be_true
|
133
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/existence_spec.js").should be_true
|
134
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/extension_spec.js").should be_true
|
135
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/module_spec.js").should be_true
|
136
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/string_utility_spec.js").should be_true
|
137
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine.yml").should be_true
|
138
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_config.rb").should be_true
|
139
|
+
File.exists?("#{SPEC_DIR}/spec/javascripts/support/jasmine_runner.rb").should be_true
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'should import the Rakefile' do
|
143
|
+
suppress_output { @project.import_rakefile }
|
144
|
+
File.exists?("#{SPEC_DIR}/Rakefile").should be_true
|
145
|
+
end
|
136
146
|
end # Project Creation
|
137
147
|
|
138
148
|
context 'Project management' do
|
@@ -158,8 +168,9 @@ describe Ninjs::Project do
|
|
158
168
|
FileUtils.rm_rf "#{SPEC_DIR}/models"
|
159
169
|
FileUtils.rm_rf "#{SPEC_DIR}/lib"
|
160
170
|
FileUtils.rm_rf "#{SPEC_DIR}/plugins"
|
161
|
-
FileUtils.rm_rf "#{SPEC_DIR}/
|
171
|
+
FileUtils.rm_rf "#{SPEC_DIR}/spec"
|
162
172
|
FileUtils.rm_rf "#{SPEC_DIR}/ninjs.conf"
|
173
|
+
FileUtils.rm_rf "#{SPEC_DIR}/Rakefile"
|
163
174
|
end
|
164
175
|
|
165
176
|
it 'should create a config file' do
|
@@ -247,5 +258,4 @@ describe Ninjs::Project do
|
|
247
258
|
end
|
248
259
|
|
249
260
|
end # Project management
|
250
|
-
|
251
261
|
end
|