jspec-steventux 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.md +763 -0
- data/Manifest +73 -0
- data/README.md +974 -0
- data/Rakefile +44 -0
- data/bin/jspec +178 -0
- data/jspec-steventux.gemspec +44 -0
- data/lib/images/bg.png +0 -0
- data/lib/images/hr.png +0 -0
- data/lib/images/loading.gif +0 -0
- data/lib/images/sprites.bg.png +0 -0
- data/lib/images/sprites.png +0 -0
- data/lib/images/vr.png +0 -0
- data/lib/jspec.css +149 -0
- data/lib/jspec.growl.js +115 -0
- data/lib/jspec.jquery.js +72 -0
- data/lib/jspec.js +1756 -0
- data/lib/jspec.shell.js +39 -0
- data/lib/jspec.timers.js +90 -0
- data/lib/jspec.xhr.js +195 -0
- data/spec/commands/example_command.rb +19 -0
- data/spec/dom.html +33 -0
- data/spec/fixtures/test.html +1 -0
- data/spec/fixtures/test.json +1 -0
- data/spec/fixtures/test.xml +5 -0
- data/spec/node.js +17 -0
- data/spec/rhino.js +23 -0
- data/spec/ruby/bin/init_spec.rb +101 -0
- data/spec/ruby/bin/install_spec.rb +142 -0
- data/spec/ruby/bin/run_spec.rb +0 -0
- data/spec/ruby/bin/shell_spec.rb +13 -0
- data/spec/ruby/bin/spec_helper.rb +8 -0
- data/spec/ruby/bin/update_spec.rb +72 -0
- data/spec/server.html +29 -0
- data/spec/server.rb +2 -0
- data/spec/support/env.js +10118 -0
- data/spec/support/jquery.js +4376 -0
- data/spec/unit/helpers.js +64 -0
- data/spec/unit/spec.fixtures.js +17 -0
- data/spec/unit/spec.grammar-less.js +34 -0
- data/spec/unit/spec.grammar.js +241 -0
- data/spec/unit/spec.jquery.js +178 -0
- data/spec/unit/spec.jquery.xhr.js +84 -0
- data/spec/unit/spec.js +187 -0
- data/spec/unit/spec.matchers.js +577 -0
- data/spec/unit/spec.modules.js +51 -0
- data/spec/unit/spec.shared-behaviors.js +80 -0
- data/spec/unit/spec.utils.js +346 -0
- data/spec/unit/spec.xhr.js +157 -0
- data/src/browsers.rb +294 -0
- data/src/helpers.rb +67 -0
- data/src/installables.rb +229 -0
- data/src/project.rb +341 -0
- data/src/routes.rb +57 -0
- data/src/server.rb +99 -0
- data/support/js.jar +0 -0
- data/templates/default/History.md +5 -0
- data/templates/default/Readme.md +29 -0
- data/templates/default/lib/yourlib.js +2 -0
- data/templates/default/spec/commands/example_command.rb +19 -0
- data/templates/default/spec/dom.html +22 -0
- data/templates/default/spec/node.js +10 -0
- data/templates/default/spec/rhino.js +10 -0
- data/templates/default/spec/server.html +18 -0
- data/templates/default/spec/server.rb +4 -0
- data/templates/default/spec/unit/spec.helper.js +0 -0
- data/templates/default/spec/unit/spec.js +8 -0
- data/templates/rails/commands/example_commands.rb +19 -0
- data/templates/rails/dom.html +22 -0
- data/templates/rails/rhino.js +10 -0
- data/templates/rails/server.html +18 -0
- data/templates/rails/server.rb +4 -0
- data/templates/rails/unit/spec.helper.js +0 -0
- data/templates/rails/unit/spec.js +8 -0
- metadata +185 -0
data/lib/jspec.shell.js
ADDED
@@ -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
|
+
})()
|
data/lib/jspec.timers.js
ADDED
@@ -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
|
+
})()
|
data/lib/jspec.xhr.js
ADDED
@@ -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
|
data/spec/dom.html
ADDED
@@ -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
|
+
<p>test</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
{ users : { tj : { email : 'tj@vision-media.ca' }}}
|
data/spec/node.js
ADDED
@@ -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') TODO: when exceptions bubble properly uncomment
|
16
|
+
.run({ reporter: JSpec.reporters.Terminal, failuresOnly: true, fixturePath: 'spec/fixtures' })
|
17
|
+
.report()
|
data/spec/rhino.js
ADDED
@@ -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
|