bootcamp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +14 -0
  5. data/Gemfile.lock +36 -0
  6. data/LICENSE.txt +20 -0
  7. data/NOTES +3 -0
  8. data/README.rdoc +49 -0
  9. data/Rakefile +42 -0
  10. data/VERSION +1 -0
  11. data/bin/bootcamp +8 -0
  12. data/bootcamp.gemspec +190 -0
  13. data/lib/bootcamp.rb +22 -0
  14. data/lib/bootcamp/armory.rb +20 -0
  15. data/lib/bootcamp/drill_instructor.rb +95 -0
  16. data/lib/bootcamp/formations/core.rb +13 -0
  17. data/lib/bootcamp/formations/html.rb +17 -0
  18. data/lib/bootcamp/formations/jquery.rb +13 -0
  19. data/lib/bootcamp/recruit.rb +28 -0
  20. data/spec/bootcamp_spec.rb +12 -0
  21. data/spec/spec_helper.rb +12 -0
  22. data/vendor/core.js +1 -0
  23. data/vendor/dojo.js +14 -0
  24. data/vendor/jquery.js +18 -0
  25. data/vendor/midori.js +1502 -0
  26. data/vendor/mootools.js +486 -0
  27. data/vendor/prototype.js +6082 -0
  28. data/vendor/test_suites/jasmine/SpecRunner.html +27 -0
  29. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/MIT.LICENSE +20 -0
  30. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine-html.js +188 -0
  31. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine.css +166 -0
  32. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine.js +2421 -0
  33. data/vendor/test_suites/jasmine/spec/PlayerSpec.js +58 -0
  34. data/vendor/test_suites/jasmine/spec/SpecHelper.js +9 -0
  35. data/vendor/test_suites/jasmine/src/Player.js +22 -0
  36. data/vendor/test_suites/jasmine/src/Song.js +7 -0
  37. data/vendor/test_suites/jspec/History.md +790 -0
  38. data/vendor/test_suites/jspec/Manifest +79 -0
  39. data/vendor/test_suites/jspec/README.md +1030 -0
  40. data/vendor/test_suites/jspec/Rakefile +28 -0
  41. data/vendor/test_suites/jspec/bin/jspec +182 -0
  42. data/vendor/test_suites/jspec/jspec.gemspec +44 -0
  43. data/vendor/test_suites/jspec/lib/images/bg.png +0 -0
  44. data/vendor/test_suites/jspec/lib/images/hr.png +0 -0
  45. data/vendor/test_suites/jspec/lib/images/loading.gif +0 -0
  46. data/vendor/test_suites/jspec/lib/images/sprites.bg.png +0 -0
  47. data/vendor/test_suites/jspec/lib/images/sprites.png +0 -0
  48. data/vendor/test_suites/jspec/lib/images/vr.png +0 -0
  49. data/vendor/test_suites/jspec/lib/jspec.css +149 -0
  50. data/vendor/test_suites/jspec/lib/jspec.growl.js +115 -0
  51. data/vendor/test_suites/jspec/lib/jspec.jquery.js +72 -0
  52. data/vendor/test_suites/jspec/lib/jspec.js +1876 -0
  53. data/vendor/test_suites/jspec/lib/jspec.shell.js +39 -0
  54. data/vendor/test_suites/jspec/lib/jspec.timers.js +90 -0
  55. data/vendor/test_suites/jspec/lib/jspec.xhr.js +195 -0
  56. data/vendor/test_suites/jspec/spec/commands/example_command.rb +19 -0
  57. data/vendor/test_suites/jspec/spec/dom.html +33 -0
  58. data/vendor/test_suites/jspec/spec/fixtures/test.html +1 -0
  59. data/vendor/test_suites/jspec/spec/fixtures/test.json +1 -0
  60. data/vendor/test_suites/jspec/spec/fixtures/test.xml +5 -0
  61. data/vendor/test_suites/jspec/spec/node.js +17 -0
  62. data/vendor/test_suites/jspec/spec/rhino.js +23 -0
  63. data/vendor/test_suites/jspec/spec/ruby/bin/init_spec.rb +101 -0
  64. data/vendor/test_suites/jspec/spec/ruby/bin/install_spec.rb +141 -0
  65. data/vendor/test_suites/jspec/spec/ruby/bin/run_spec.rb +0 -0
  66. data/vendor/test_suites/jspec/spec/ruby/bin/shell_spec.rb +13 -0
  67. data/vendor/test_suites/jspec/spec/ruby/bin/spec_helper.rb +8 -0
  68. data/vendor/test_suites/jspec/spec/ruby/bin/update_spec.rb +72 -0
  69. data/vendor/test_suites/jspec/spec/server.html +29 -0
  70. data/vendor/test_suites/jspec/spec/server.rb +2 -0
  71. data/vendor/test_suites/jspec/spec/support/env.js +10118 -0
  72. data/vendor/test_suites/jspec/spec/support/jquery.js +4376 -0
  73. data/vendor/test_suites/jspec/spec/unit/helpers.js +64 -0
  74. data/vendor/test_suites/jspec/spec/unit/spec.fixtures.js +24 -0
  75. data/vendor/test_suites/jspec/spec/unit/spec.grammar-less.js +34 -0
  76. data/vendor/test_suites/jspec/spec/unit/spec.grammar.js +275 -0
  77. data/vendor/test_suites/jspec/spec/unit/spec.jquery.js +178 -0
  78. data/vendor/test_suites/jspec/spec/unit/spec.jquery.xhr.js +84 -0
  79. data/vendor/test_suites/jspec/spec/unit/spec.js +187 -0
  80. data/vendor/test_suites/jspec/spec/unit/spec.matchers.js +577 -0
  81. data/vendor/test_suites/jspec/spec/unit/spec.modules.js +51 -0
  82. data/vendor/test_suites/jspec/spec/unit/spec.shared-behaviors.js +279 -0
  83. data/vendor/test_suites/jspec/spec/unit/spec.utils.js +346 -0
  84. data/vendor/test_suites/jspec/spec/unit/spec.xhr.js +157 -0
  85. data/vendor/test_suites/jspec/src/browsers.rb +279 -0
  86. data/vendor/test_suites/jspec/src/helpers.rb +67 -0
  87. data/vendor/test_suites/jspec/src/installables.rb +229 -0
  88. data/vendor/test_suites/jspec/src/project.rb +341 -0
  89. data/vendor/test_suites/jspec/src/routes.rb +57 -0
  90. data/vendor/test_suites/jspec/src/server.rb +88 -0
  91. data/vendor/test_suites/jspec/support/js.jar +0 -0
  92. data/vendor/test_suites/jspec/templates/default/History.md +5 -0
  93. data/vendor/test_suites/jspec/templates/default/Readme.md +29 -0
  94. data/vendor/test_suites/jspec/templates/default/lib/yourlib.js +2 -0
  95. data/vendor/test_suites/jspec/templates/default/spec/commands/example_command.rb +19 -0
  96. data/vendor/test_suites/jspec/templates/default/spec/dom.html +22 -0
  97. data/vendor/test_suites/jspec/templates/default/spec/node.js +10 -0
  98. data/vendor/test_suites/jspec/templates/default/spec/rhino.js +10 -0
  99. data/vendor/test_suites/jspec/templates/default/spec/server.html +18 -0
  100. data/vendor/test_suites/jspec/templates/default/spec/server.rb +4 -0
  101. data/vendor/test_suites/jspec/templates/default/spec/unit/spec.helper.js +0 -0
  102. data/vendor/test_suites/jspec/templates/default/spec/unit/spec.js +8 -0
  103. data/vendor/test_suites/jspec/templates/node/History.md +5 -0
  104. data/vendor/test_suites/jspec/templates/node/Readme.md +29 -0
  105. data/vendor/test_suites/jspec/templates/node/lib/yourlib.js +2 -0
  106. data/vendor/test_suites/jspec/templates/node/spec/node.js +10 -0
  107. data/vendor/test_suites/jspec/templates/node/spec/unit/spec.helper.js +0 -0
  108. data/vendor/test_suites/jspec/templates/node/spec/unit/spec.js +8 -0
  109. data/vendor/test_suites/jspec/templates/rails/commands/example_commands.rb +19 -0
  110. data/vendor/test_suites/jspec/templates/rails/dom.html +22 -0
  111. data/vendor/test_suites/jspec/templates/rails/rhino.js +10 -0
  112. data/vendor/test_suites/jspec/templates/rails/server.html +18 -0
  113. data/vendor/test_suites/jspec/templates/rails/server.rb +4 -0
  114. data/vendor/test_suites/jspec/templates/rails/unit/spec.helper.js +0 -0
  115. data/vendor/test_suites/jspec/templates/rails/unit/spec.js +8 -0
  116. data/vendor/test_suites/qunit/README.md +24 -0
  117. data/vendor/test_suites/qunit/package.json +21 -0
  118. data/vendor/test_suites/qunit/qunit/qunit.css +225 -0
  119. data/vendor/test_suites/qunit/qunit/qunit.js +1448 -0
  120. data/vendor/test_suites/qunit/test/headless.html +24 -0
  121. data/vendor/test_suites/qunit/test/index.html +19 -0
  122. data/vendor/test_suites/qunit/test/logs.html +17 -0
  123. data/vendor/test_suites/qunit/test/logs.js +150 -0
  124. data/vendor/test_suites/qunit/test/same.js +1421 -0
  125. data/vendor/test_suites/qunit/test/test.js +324 -0
  126. metadata +282 -0
@@ -0,0 +1,39 @@
1
+
2
+ // JSpec - Shell - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
3
+
4
+ ;(function(){
5
+
6
+ var _quit = quit
7
+
8
+ Shell = {
9
+
10
+ // --- Global
11
+
12
+ main: this,
13
+
14
+ // --- Commands
15
+
16
+ commands: {
17
+ quit: ['Terminate the shell', function(){ _quit() }],
18
+ exit: ['Terminate the shell', function(){ _quit() }],
19
+ p: ['Inspect an object', function(o){ return o.toSource() }]
20
+ },
21
+
22
+ /**
23
+ * Start the interactive shell.
24
+ *
25
+ * @api public
26
+ */
27
+
28
+ start : function() {
29
+ for (var name in this.commands)
30
+ if (this.commands.hasOwnProperty(name))
31
+ this.commands[name][1].length ?
32
+ this.main[name] = this.commands[name][1] :
33
+ this.main.__defineGetter__(name, this.commands[name][1])
34
+ }
35
+ }
36
+
37
+ Shell.start()
38
+
39
+ })()
@@ -0,0 +1,90 @@
1
+
2
+ // JSpec - Mock Timers - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
3
+
4
+ ;(function(){
5
+
6
+ /**
7
+ * Version.
8
+ */
9
+
10
+ mockTimersVersion = '1.0.2'
11
+
12
+ /**
13
+ * Localized timer stack.
14
+ */
15
+
16
+ var timers = []
17
+
18
+ /**
19
+ * Set mock timeout with _callback_ and timeout of _ms_.
20
+ *
21
+ * @param {function} callback
22
+ * @param {int} ms
23
+ * @return {int}
24
+ * @api public
25
+ */
26
+
27
+ setTimeout = function(callback, ms) {
28
+ var id
29
+ return id = setInterval(function(){
30
+ callback()
31
+ clearInterval(id)
32
+ }, ms)
33
+ }
34
+
35
+ /**
36
+ * Set mock interval with _callback_ and interval of _ms_.
37
+ *
38
+ * @param {function} callback
39
+ * @param {int} ms
40
+ * @return {int}
41
+ * @api public
42
+ */
43
+
44
+ setInterval = function(callback, ms) {
45
+ callback.step = ms, callback.current = callback.last = 0
46
+ return timers[timers.length] = callback, timers.length
47
+ }
48
+
49
+ /**
50
+ * Destroy timer with _id_.
51
+ *
52
+ * @param {int} id
53
+ * @return {bool}
54
+ * @api public
55
+ */
56
+
57
+ clearInterval = clearTimeout = function(id) {
58
+ return delete timers[--id]
59
+ }
60
+
61
+ /**
62
+ * Reset timers.
63
+ *
64
+ * @return {array}
65
+ * @api public
66
+ */
67
+
68
+ resetTimers = function() {
69
+ return timers = []
70
+ }
71
+
72
+ /**
73
+ * Increment each timers internal clock by _ms_.
74
+ *
75
+ * @param {int} ms
76
+ * @api public
77
+ */
78
+
79
+ tick = function(ms) {
80
+ for (var i = 0, len = timers.length; i < len; ++i)
81
+ if (timers[i] && (timers[i].current += ms))
82
+ if (timers[i].current - timers[i].last >= timers[i].step) {
83
+ var times = Math.floor((timers[i].current - timers[i].last) / timers[i].step)
84
+ var remainder = (timers[i].current - timers[i].last) % timers[i].step
85
+ timers[i].last = timers[i].current - remainder
86
+ while (times-- && timers[i]) timers[i]()
87
+ }
88
+ }
89
+
90
+ })()
@@ -0,0 +1,195 @@
1
+
2
+ // JSpec - XHR - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
3
+
4
+ (function(){
5
+
6
+ var lastRequest
7
+
8
+ // --- Original XMLHttpRequest
9
+
10
+ var OriginalXMLHttpRequest = 'XMLHttpRequest' in this ?
11
+ XMLHttpRequest :
12
+ function(){}
13
+ var OriginalActiveXObject = 'ActiveXObject' in this ?
14
+ ActiveXObject :
15
+ undefined
16
+
17
+ // --- MockXMLHttpRequest
18
+
19
+ var MockXMLHttpRequest = function() {
20
+ this.requestHeaders = {}
21
+ }
22
+
23
+ MockXMLHttpRequest.prototype = {
24
+ status: 0,
25
+ async: true,
26
+ readyState: 0,
27
+ responseText: '',
28
+ abort: function(){},
29
+ onreadystatechange: function(){},
30
+
31
+ /**
32
+ * Return response headers hash.
33
+ */
34
+
35
+ getAllResponseHeaders : function(){
36
+ return this.responseHeaders
37
+ },
38
+
39
+ /**
40
+ * Return case-insensitive value for header _name_.
41
+ */
42
+
43
+ getResponseHeader : function(name) {
44
+ return this.responseHeaders[name.toLowerCase()]
45
+ },
46
+
47
+ /**
48
+ * Set case-insensitive _value_ for header _name_.
49
+ */
50
+
51
+ setRequestHeader : function(name, value) {
52
+ this.requestHeaders[name.toLowerCase()] = value
53
+ },
54
+
55
+ /**
56
+ * Open mock request.
57
+ */
58
+
59
+ open : function(method, url, async, user, password) {
60
+ this.user = user
61
+ this.password = password
62
+ this.url = url
63
+ this.readyState = 1
64
+ this.method = method.toUpperCase()
65
+ if (async != undefined) this.async = async
66
+ if (this.async) this.onreadystatechange()
67
+ },
68
+
69
+ /**
70
+ * Send request _data_.
71
+ */
72
+
73
+ send : function(data) {
74
+ var self = this
75
+ this.data = data
76
+ this.readyState = 4
77
+ if (this.method == 'HEAD') this.responseText = null
78
+ this.responseHeaders['content-length'] = (this.responseText || '').length
79
+ if(this.async) this.onreadystatechange()
80
+ lastRequest = function(){
81
+ return self
82
+ }
83
+ }
84
+ }
85
+
86
+ // --- Response status codes
87
+
88
+ JSpec.statusCodes = {
89
+ 100: 'Continue',
90
+ 101: 'Switching Protocols',
91
+ 200: 'OK',
92
+ 201: 'Created',
93
+ 202: 'Accepted',
94
+ 203: 'Non-Authoritative Information',
95
+ 204: 'No Content',
96
+ 205: 'Reset Content',
97
+ 206: 'Partial Content',
98
+ 300: 'Multiple Choice',
99
+ 301: 'Moved Permanently',
100
+ 302: 'Found',
101
+ 303: 'See Other',
102
+ 304: 'Not Modified',
103
+ 305: 'Use Proxy',
104
+ 307: 'Temporary Redirect',
105
+ 400: 'Bad Request',
106
+ 401: 'Unauthorized',
107
+ 402: 'Payment Required',
108
+ 403: 'Forbidden',
109
+ 404: 'Not Found',
110
+ 405: 'Method Not Allowed',
111
+ 406: 'Not Acceptable',
112
+ 407: 'Proxy Authentication Required',
113
+ 408: 'Request Timeout',
114
+ 409: 'Conflict',
115
+ 410: 'Gone',
116
+ 411: 'Length Required',
117
+ 412: 'Precondition Failed',
118
+ 413: 'Request Entity Too Large',
119
+ 414: 'Request-URI Too Long',
120
+ 415: 'Unsupported Media Type',
121
+ 416: 'Requested Range Not Satisfiable',
122
+ 417: 'Expectation Failed',
123
+ 422: 'Unprocessable Entity',
124
+ 500: 'Internal Server Error',
125
+ 501: 'Not Implemented',
126
+ 502: 'Bad Gateway',
127
+ 503: 'Service Unavailable',
128
+ 504: 'Gateway Timeout',
129
+ 505: 'HTTP Version Not Supported'
130
+ }
131
+
132
+ /**
133
+ * Mock XMLHttpRequest requests.
134
+ *
135
+ * mockRequest().and_return('some data', 'text/plain', 200, { 'X-SomeHeader' : 'somevalue' })
136
+ *
137
+ * @return {hash}
138
+ * @api public
139
+ */
140
+
141
+ function mockRequest() {
142
+ return { and_return : function(body, type, status, headers) {
143
+ XMLHttpRequest = MockXMLHttpRequest
144
+ ActiveXObject = false
145
+ status = status || 200
146
+ headers = headers || {}
147
+ headers['content-type'] = type
148
+ JSpec.extend(XMLHttpRequest.prototype, {
149
+ responseText: body,
150
+ responseHeaders: headers,
151
+ status: status,
152
+ statusText: JSpec.statusCodes[status]
153
+ })
154
+ }}
155
+ }
156
+
157
+ /**
158
+ * Unmock XMLHttpRequest requests.
159
+ *
160
+ * @api public
161
+ */
162
+
163
+ function unmockRequest() {
164
+ XMLHttpRequest = OriginalXMLHttpRequest
165
+ ActiveXObject = OriginalActiveXObject
166
+ }
167
+
168
+ JSpec.include({
169
+ name: 'Mock XHR',
170
+
171
+ // --- Utilities
172
+
173
+ utilities : {
174
+ mockRequest: mockRequest,
175
+ unmockRequest: unmockRequest
176
+ },
177
+
178
+ // --- Hooks
179
+
180
+ afterSpec : function() {
181
+ unmockRequest()
182
+ },
183
+
184
+ // --- DSLs
185
+
186
+ DSLs : {
187
+ snake : {
188
+ mock_request: mockRequest,
189
+ unmock_request: unmockRequest,
190
+ last_request: function(){ return lastRequest() }
191
+ }
192
+ }
193
+
194
+ })
195
+ })()
@@ -0,0 +1,19 @@
1
+
2
+ # uncomment and call with `$ jspec example `
3
+
4
+ # command :example do |c|
5
+ # c.syntax = 'jspec example [options]'
6
+ # c.description = 'Just an example command'
7
+ # c.option '-f', '--foo string', 'Does some foo with <string>'
8
+ # c.option '-b', '--bar [string]', 'Does some bar with [string]'
9
+ # c.example 'Do some foo', 'jspec example --foo bar'
10
+ # c.example 'Do some bar', 'jspec example --bar'
11
+ # c.when_called do |args, options|
12
+ # p args
13
+ # p options.__hash__
14
+ # # options.foo
15
+ # # options.bar
16
+ # # options.__hash__[:foo]
17
+ # # options.__hash__[:bar]
18
+ # end
19
+ # end
@@ -0,0 +1,33 @@
1
+ <html>
2
+ <head>
3
+ <link type="text/css" rel="stylesheet" href="../lib/jspec.css" />
4
+ <script src="support/jquery.js"></script>
5
+ <script src="../lib/jspec.js"></script>
6
+ <script src="../lib/jspec.jquery.js"></script>
7
+ <script src="../lib/jspec.xhr.js"></script>
8
+ <script src="unit/helpers.js"></script>
9
+ <script src="unit/spec.grammar-less.js"></script>
10
+ <script>
11
+ function runSuites() {
12
+ JSpec
13
+ .exec('unit/spec.grammar.js')
14
+ .exec('unit/spec.js')
15
+ .exec('unit/spec.matchers.js')
16
+ .exec('unit/spec.utils.js')
17
+ .exec('unit/spec.fixtures.js')
18
+ .exec('unit/spec.shared-behaviors.js')
19
+ .exec('unit/spec.jquery.js')
20
+ .exec('unit/spec.modules.js')
21
+ .exec('unit/spec.xhr.js')
22
+ .exec('unit/spec.jquery.xhr.js')
23
+ .run({ failuresOnly: true, fixturePath: 'fixtures' })
24
+ .report()
25
+ }
26
+ </script>
27
+ </head>
28
+ <body class="jspec" onLoad="runSuites();">
29
+ <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
30
+ <div id="jspec"><div class="loading"></div></div>
31
+ <div id="jspec-bottom"></div>
32
+ </body>
33
+ </html>
@@ -0,0 +1 @@
1
+ { users : { tj : { email : 'tj@vision-media.ca' }}}
@@ -0,0 +1,5 @@
1
+ <users>
2
+ <user name="tj">
3
+ <email>tj@vision-media.ca</email>
4
+ </user>
5
+ </users>
@@ -0,0 +1,17 @@
1
+
2
+ require.paths.unshift('./lib', './spec');
3
+
4
+ require("jspec")
5
+ require("unit/helpers")
6
+
7
+ JSpec
8
+ .exec('spec/unit/spec.js')
9
+ .exec('spec/unit/spec.utils.js')
10
+ .exec('spec/unit/spec.modules.js')
11
+ .exec('spec/unit/spec.matchers.js')
12
+ .exec('spec/unit/spec.shared-behaviors.js')
13
+ .exec('spec/unit/spec.grammar.js')
14
+ .exec('spec/unit/spec.grammar-less.js')
15
+ .exec('spec/unit/spec.fixtures.js')
16
+ .run({ reporter: JSpec.reporters.Terminal, failuresOnly: true, fixturePath: 'spec/fixtures' })
17
+ .report()
@@ -0,0 +1,23 @@
1
+
2
+ load('spec/support/env.js')
3
+ Envjs('spec/fixtures/test.html')
4
+ load('spec/support/jquery.js')
5
+ load('lib/jspec.js')
6
+ load('lib/jspec.xhr.js')
7
+ load('lib/jspec.jquery.js')
8
+ load('spec/unit/helpers.js')
9
+ load('spec/unit/spec.grammar-less.js')
10
+
11
+ JSpec
12
+ .exec('spec/unit/spec.grammar.js')
13
+ .exec('spec/unit/spec.js')
14
+ .exec('spec/unit/spec.matchers.js')
15
+ .exec('spec/unit/spec.utils.js')
16
+ .exec('spec/unit/spec.jquery.js')
17
+ .exec('spec/unit/spec.fixtures.js')
18
+ .exec('spec/unit/spec.shared-behaviors.js')
19
+ .exec('spec/unit/spec.modules.js')
20
+ .exec('spec/unit/spec.xhr.js')
21
+ .exec('spec/unit/spec.jquery.xhr.js')
22
+ .run({ reporter: JSpec.reporters.Terminal, failuresOnly: true, fixturePath: 'spec/fixtures' })
23
+ .report()
@@ -0,0 +1,101 @@
1
+
2
+ include FileUtils
3
+
4
+ describe "jspec" do
5
+ describe "init" do
6
+ before :each do
7
+ @dest = File.dirname(__FILE__) + '/test'
8
+ mkdir @dest
9
+ end
10
+
11
+ after :each do
12
+ rm_rf @dest
13
+ end
14
+
15
+ it "should initialize a default project at the current directory when no destination is passed" do
16
+ Dir.chdir @dest do
17
+ jspec(:init)
18
+ File.directory?(@dest).should be_true
19
+ end
20
+ end
21
+
22
+ it "should initialize a default project at the given path" do
23
+ jspec(:init, @dest).should include('ruby/bin/test')
24
+ File.directory?(@dest).should be_true
25
+ end
26
+
27
+ it "should initialize a rails project when using -R or --rails" do
28
+ mkdir @dest + '/vendor'
29
+ jspec(:init, @dest, '--rails')
30
+ File.directory?(@dest).should be_true
31
+ File.directory?(@dest + '/jspec').should be_true
32
+ end
33
+
34
+ it "should initialize a rails project without --rails when the destination looks like a rails app" do
35
+ mkdir @dest + '/vendor'
36
+ jspec(:init, @dest)
37
+ File.directory?(@dest).should be_true
38
+ File.directory?(@dest + '/jspec').should be_true
39
+ end
40
+
41
+ it "should symlink jspec's library to spec/lib when using --symlink" do
42
+ jspec(:init, @dest, '--symlink')
43
+ File.directory?(@dest).should be_true
44
+ File.symlink?(@dest + '/spec/lib').should be_true
45
+ end
46
+
47
+ it "should symlink jspec's library to jspec/lib when using --symlink and --rails" do
48
+ mkdir @dest + '/vendor'
49
+ jspec(:init, @dest, '--symlink', '--rails')
50
+ File.directory?(@dest).should be_true
51
+ File.directory?(@dest + '/jspec').should be_true
52
+ File.symlink?(@dest + '/jspec/lib').should be_true
53
+ end
54
+
55
+ it "should vendorize jspec's library to spec/lib when using --freeze" do
56
+ jspec(:init, @dest, '--freeze')
57
+ File.directory?(@dest).should be_true
58
+ File.directory?(@dest + '/spec/lib').should be_true
59
+ File.exists?(@dest + '/spec/lib/jspec.js').should be_true
60
+ end
61
+
62
+ it "should vendor jspec's library to jspec/lib when using --freeze and --rails" do
63
+ mkdir @dest + '/vendor'
64
+ jspec(:init, @dest, '--freeze', '--rails')
65
+ File.directory?(@dest).should be_true
66
+ File.directory?(@dest + '/jspec').should be_true
67
+ File.directory?(@dest + '/jspec/lib').should be_true
68
+ File.exists?(@dest + '/jspec/lib/jspec.js').should be_true
69
+ end
70
+
71
+ it "should set jspec's DOM root to jspec's gem directory" do
72
+ jspec(:init, @dest)
73
+ File.read(@dest + '/spec/dom.html').should include('src="/')
74
+ end
75
+
76
+ it "should set jspec's DOM root to ../lib/ when using --freeze" do
77
+ jspec(:init, @dest, '--freeze')
78
+ File.read(@dest + '/spec/dom.html').should include('src="./lib/jspec.js')
79
+ end
80
+
81
+ it "should set jspec's DOM root to ../lib/ when using --symlink" do
82
+ jspec(:init, @dest, '--symlink')
83
+ File.read(@dest + '/spec/dom.html').should include('src="./lib/jspec.js')
84
+ end
85
+
86
+ it "should set jspec's Rhino root to jspec's gem directory" do
87
+ jspec(:init, @dest)
88
+ File.read(@dest + '/spec/rhino.js').should_not include("load('./spec/lib/jspec.js')")
89
+ end
90
+
91
+ it "should set jspec's Rhino root to ./spec/lib/ when using --freeze" do
92
+ jspec(:init, @dest, '--freeze')
93
+ File.read(@dest + '/spec/rhino.js').should include("load('./spec/lib/jspec.js')")
94
+ end
95
+
96
+ it "should set jspec's Rhino root to ./spec/lib/ when using --symlink" do
97
+ jspec(:init, @dest, '--symlink')
98
+ File.read(@dest + '/spec/rhino.js').should include("load('./spec/lib/jspec.js')")
99
+ end
100
+ end
101
+ end