jspec 2.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/History.rdoc +522 -0
  2. data/Manifest +57 -0
  3. data/README.rdoc +825 -0
  4. data/Rakefile +75 -0
  5. data/bin/jspec +305 -0
  6. data/jspec.gemspec +44 -0
  7. data/lib/images/bg.png +0 -0
  8. data/lib/images/hr.png +0 -0
  9. data/lib/images/loading.gif +0 -0
  10. data/lib/images/sprites.bg.png +0 -0
  11. data/lib/images/sprites.png +0 -0
  12. data/lib/images/vr.png +0 -0
  13. data/lib/jspec.css +145 -0
  14. data/lib/jspec.jquery.js +71 -0
  15. data/lib/jspec.js +1771 -0
  16. data/lib/jspec.shell.js +36 -0
  17. data/lib/jspec.timers.js +90 -0
  18. data/lib/jspec.xhr.js +183 -0
  19. data/server/browsers.rb +228 -0
  20. data/server/helpers.rb +82 -0
  21. data/server/routes.rb +57 -0
  22. data/server/server.rb +88 -0
  23. data/spec/async +1 -0
  24. data/spec/env.js +695 -0
  25. data/spec/fixtures/test.html +1 -0
  26. data/spec/fixtures/test.json +1 -0
  27. data/spec/fixtures/test.xml +5 -0
  28. data/spec/helpers.js +66 -0
  29. data/spec/server.rb +2 -0
  30. data/spec/spec.dom.html +34 -0
  31. data/spec/spec.fixtures.js +18 -0
  32. data/spec/spec.grammar-less.js +34 -0
  33. data/spec/spec.grammar.js +226 -0
  34. data/spec/spec.jquery.js +176 -0
  35. data/spec/spec.jquery.xhr.js +65 -0
  36. data/spec/spec.js +166 -0
  37. data/spec/spec.matchers.js +493 -0
  38. data/spec/spec.modules.js +67 -0
  39. data/spec/spec.node.js +46 -0
  40. data/spec/spec.rhino.js +17 -0
  41. data/spec/spec.server.html +29 -0
  42. data/spec/spec.shared-behaviors.js +80 -0
  43. data/spec/spec.utils.js +279 -0
  44. data/spec/spec.xhr.js +156 -0
  45. data/templates/default/History.rdoc +4 -0
  46. data/templates/default/README.rdoc +29 -0
  47. data/templates/default/lib/yourlib.core.js +2 -0
  48. data/templates/default/spec/server.rb +4 -0
  49. data/templates/default/spec/spec.core.js +8 -0
  50. data/templates/default/spec/spec.dom.html +20 -0
  51. data/templates/default/spec/spec.rhino.js +8 -0
  52. data/templates/default/spec/spec.server.html +16 -0
  53. data/templates/rails/server.rb +4 -0
  54. data/templates/rails/spec.application.js +8 -0
  55. data/templates/rails/spec.dom.html +20 -0
  56. data/templates/rails/spec.rhino.js +8 -0
  57. data/templates/rails/spec.server.html +16 -0
  58. metadata +168 -0
@@ -0,0 +1,67 @@
1
+
2
+ describe 'JSpec'
3
+ describe 'module'
4
+ describe 'hooks'
5
+ it 'should run beforeSpec'
6
+ addedBeforeSpec.should.be_true
7
+ end
8
+
9
+ it 'should run afterSpec'
10
+ addedAfterSpec.should.be_true
11
+ end
12
+
13
+ describe 'with suites'
14
+ it 'should run beforeSuite'
15
+ addedBeforeSuite.should.be_true
16
+ end
17
+ end
18
+
19
+ it 'should run afterSuite'
20
+ addedAfterSuite.should.be_true
21
+ end
22
+
23
+ it 'should run in context with JSpec'
24
+ hook('checkJSpecContext')[0].should.equal JSpec.each
25
+ end
26
+
27
+ it 'should run in context to JSpecs default context'
28
+ hook('checkContext')[0].should.eql fixture('test')
29
+ end
30
+
31
+ it 'should run in context to the module itself'
32
+ hook('checkModuleContext')[0].should.eql 'ExampleModule'
33
+ end
34
+
35
+ it 'should run in context to the modules utilities'
36
+ hook('checkUtilityContext')[0].should.eql 'foo'
37
+ end
38
+ end
39
+
40
+ describe '.hook()'
41
+ it 'should invoke hooks, returning an array of results'
42
+ results = hook('randomHook', 'foo', 'bar')
43
+ results.should.eql [['foo', 'bar']]
44
+ end
45
+ end
46
+
47
+ describe '.utilities'
48
+ it 'should be merged with the default utilities'
49
+ doFoo().should.eql 'foo'
50
+ doBar().should.eql 'bar'
51
+ end
52
+ end
53
+
54
+ describe '.matchers'
55
+ it 'should be merged with default matchers'
56
+ 'test'.should.be_foo_bar
57
+ end
58
+ end
59
+
60
+ describe '.DSLs'
61
+ it 'should be merged with default DSLs'
62
+ JSpec.DSLs.snake.some_snake_case_stuff().should.be_true
63
+ JSpec.DSLs.camel.someCamelCaseStuff().should.be_true
64
+ end
65
+ end
66
+ end
67
+ end
data/spec/spec.node.js ADDED
@@ -0,0 +1,46 @@
1
+
2
+ __loading__ = []
3
+ __loadDelay__ = 1000
4
+
5
+ originalPrint = print
6
+ print = puts
7
+
8
+ readFile = function(path, callback) {
9
+ __loading__.push(path)
10
+ var promise = node.fs.cat(path, "utf8")
11
+ promise.addErrback(function(){ throw "failed to read file `" + path + "'" })
12
+ promise.addCallback(function(contents){
13
+ setTimeout(function(){
14
+ if (__loading__[0] == path)
15
+ __loading__.shift(), callback(contents)
16
+ else
17
+ setTimeout(arguments.callee, 50)
18
+ }, 50)
19
+ })
20
+ }
21
+
22
+ load = function(path) {
23
+ readFile(path, function(contents){
24
+ eval(contents)
25
+ })
26
+ }
27
+
28
+ load('lib/jspec.js')
29
+ load('spec/modules.js')
30
+ load('spec/spec.grammar-less.js')
31
+
32
+ setTimeout(function(){
33
+ JSpec
34
+ .exec('spec/spec.grammar.js')
35
+ .exec('spec/spec.js')
36
+ .exec('spec/spec.matchers.js')
37
+ .exec('spec/spec.utils.js')
38
+ .exec('spec/spec.shared-behaviors.js')
39
+ setTimeout(function(){
40
+ JSpec.run({ formatter : JSpec.formatters.Terminal, failuresOnly : false })
41
+ setTimeout(function() {
42
+ JSpec.report()
43
+ }, __loadDelay__ / 3)
44
+ }, __loadDelay__ / 3)
45
+ }, __loadDelay__ / 3)
46
+
@@ -0,0 +1,17 @@
1
+
2
+ load('lib/jspec.js')
3
+ load('lib/jspec.xhr.js')
4
+ load('spec/helpers.js')
5
+ load('spec/spec.grammar-less.js')
6
+
7
+ JSpec
8
+ .exec('spec/spec.grammar.js')
9
+ .exec('spec/spec.js')
10
+ .exec('spec/spec.matchers.js')
11
+ .exec('spec/spec.utils.js')
12
+ .exec('spec/spec.fixtures.js')
13
+ .exec('spec/spec.shared-behaviors.js')
14
+ .exec('spec/spec.modules.js')
15
+ .exec('spec/spec.xhr.js')
16
+ .run({ formatter : JSpec.formatters.Terminal, failuresOnly : false })
17
+ .report()
@@ -0,0 +1,29 @@
1
+ <html>
2
+ <head>
3
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
4
+ <script src="/jspec/jspec.js"></script>
5
+ <script src="/jspec/jspec.jquery.js"></script>
6
+ <script src="/jspec/jspec.xhr.js"></script>
7
+ <script src="helpers.js"></script>
8
+ <script src="spec.grammar-less.js"></script>
9
+ <script>
10
+ function runSuites() {
11
+ JSpec
12
+ .exec('spec.grammar.js')
13
+ .exec('spec.js')
14
+ .exec('spec.matchers.js')
15
+ .exec('spec.utils.js')
16
+ .exec('spec.fixtures.js')
17
+ .exec('spec.shared-behaviors.js')
18
+ .exec('spec.jquery.js')
19
+ .exec('spec.modules.js')
20
+ .exec('spec.xhr.js')
21
+ .exec('spec.jquery.xhr.js')
22
+ .run({ formatter : JSpec.formatters.Server })
23
+ .report()
24
+ }
25
+ </script>
26
+ </head>
27
+ <body class="jspec" onLoad="runSuites();">
28
+ </body>
29
+ </html>
@@ -0,0 +1,80 @@
1
+
2
+ describe 'Shared Behaviors'
3
+ describe 'User'
4
+ before
5
+ User = function(name) { this.name = name }
6
+ user = new User('joe')
7
+ end
8
+
9
+ it 'should have a name'
10
+ user.should.have_property 'name'
11
+ end
12
+
13
+ describe 'Administrator'
14
+ should_behave_like('User')
15
+
16
+ before
17
+ Admin = function(name) { this.name = name }
18
+ Admin.prototype.may = function(perm){ return true }
19
+ user = new Admin('tj')
20
+ end
21
+
22
+ it 'should have access to all permissions'
23
+ user.may('edit pages').should.be_true
24
+ user.may('delete users').should.be_true
25
+ end
26
+
27
+ describe 'Super Administrator'
28
+ should_behave_like('Administrator')
29
+
30
+ before
31
+ SuperAdmin = function(name) { this.name = name }
32
+ SuperAdmin.prototype.may = function(perm){ return true }
33
+ user = new SuperAdmin('tj')
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ describe 'User with toString()'
40
+ before
41
+ user = { toString : function() { return '<User tj>' }}
42
+ end
43
+
44
+ it 'should return &lt;User NAME&gt;'
45
+ user.toString().should.match(/\<User/)
46
+ end
47
+ end
48
+
49
+ describe 'Manager'
50
+ should_behave_like('User')
51
+ should_behave_like('User with toString()')
52
+
53
+ before
54
+ Manager = function(name) { this.name = name }
55
+ Manager.prototype.may = function(perm){ return perm == 'hire' || perm == 'fire' }
56
+ Manager.prototype.toString = function(){ return '<User ' + this.name + '>' }
57
+ user = new Manager('tj')
58
+ end
59
+
60
+ it 'should have access to hire or fire employees'
61
+ user.may('hire').should.be_true
62
+ user.may('fire').should.be_true
63
+ user.may('do anything else').should.be_false
64
+ end
65
+ end
66
+
67
+ describe 'findSuite'
68
+ it 'should find a suite by full description'
69
+ JSpec.findSuite('Shared Behaviors User Administrator').should.be_a JSpec.Suite
70
+ end
71
+
72
+ it 'should find a suite by name'
73
+ JSpec.findSuite('User').should.be_a JSpec.Suite
74
+ end
75
+
76
+ it 'should return null when not found'
77
+ JSpec.findSuite('Rawr').should.be_null
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,279 @@
1
+
2
+ describe 'Utility'
3
+ describe 'fail()'
4
+ it 'should fail the current spec'
5
+ spec = mock_it(function() {
6
+ fail('I failed!')
7
+ })
8
+ spec.should.have_failure_message('I failed!')
9
+ end
10
+ end
11
+
12
+ describe 'pass()'
13
+ it 'should pass the current spec'
14
+ pass('yay')
15
+ pass('wahoo')
16
+ end
17
+ end
18
+
19
+ describe 'stubbing'
20
+ before_each
21
+ Object.prototype.stubby = function() { return 'Not stubbed' }
22
+ object = { toString : function() { return '<Im an object>' }}
23
+ stub(object, 'stubby').and_return('Im stubbed')
24
+ stub(object, 'toString').and_return('<No im not>')
25
+ end
26
+
27
+ after_each
28
+ delete Object.prototype.stubby
29
+ end
30
+
31
+ describe 'stub()'
32
+ it 'should stub :)'
33
+ object.stubby().should.eql 'Im stubbed'
34
+ object.toString().should.eql '<No im not>'
35
+ end
36
+
37
+ it 'should allow being called as a core prototype method'
38
+ foo = { bar : function(){ return 'baz' }}
39
+ foo.stub('bar').and_return('something else')
40
+ foo.bar().should.eql 'something else'
41
+ foo.destub()
42
+ foo.bar().should.eql 'baz'
43
+ end
44
+
45
+ it 'should stub methods starting with an underscore'
46
+ object._foo = function(){ return 'bar' }
47
+ object.stub('_foo').and_return('something else')
48
+ object._foo().should.eql 'something else'
49
+ object.destub()
50
+ object._foo().should.eql 'bar'
51
+ end
52
+
53
+ it 'should stub methods with whitespace'
54
+ object['foo bar'] = function(){ return 'rawr' }
55
+ object.stub('foo bar').and_return('baz')
56
+ object['foo bar']().should.eql 'baz'
57
+ object.destub()
58
+ object['foo bar']().should.eql 'rawr'
59
+ end
60
+
61
+ it 'should stub with arbitrary method when no return value is set'
62
+ object.stub(' super cool ')
63
+ object[' super cool '].should.be_a Function
64
+ destub(object)
65
+ object[' super cool '].should.be_null
66
+ end
67
+
68
+ it 'should stub sub properties using the JSpec grammar'
69
+ object = { foo : { bar : {}}}
70
+ object.foo.bar.stub('kitten').and_return('meow')
71
+ object.foo.bar.kitten().should.eql 'meow'
72
+ object.foo.bar.destub()
73
+ object.foo.bar.should.not.respond_to('kitten')
74
+ end
75
+
76
+ it 'should allow functions to be passed as a method'
77
+ stub(object, 'post').and_return(function(url, callback){
78
+ if (url == 'http://jspec.info')
79
+ callback('is awesome')
80
+ })
81
+ object.post('http://jspec.info', function(text){
82
+ text.should_eql 'is awesome'
83
+ })
84
+ end
85
+ end
86
+
87
+ describe 'destub()'
88
+ it 'should restore old methods'
89
+ destub(object, 'toString')
90
+ destub(object, 'stubby')
91
+ object.toString().should.eql '<Im an object>'
92
+ object.stubby().should.eql 'Not stubbed'
93
+ end
94
+
95
+ it 'should restore prototypal methods'
96
+ Object.prototype.stubby = function() { return 'Oh no im new' }
97
+ destub(object, 'stubby')
98
+ object.stubby().should.eql 'Oh no im new'
99
+ end
100
+
101
+ it 'should destub all methods stubbed related to the object passed when no method is given'
102
+ destub(object)
103
+ object.toString().should.eql '<Im an object>'
104
+ object.stubby().should.eql 'Not stubbed'
105
+ end
106
+
107
+ describe 'should restore after each spec'
108
+ before
109
+ a = { toString : function(){ return 'Wahoo' }}
110
+ b = { toString : function(){ return 'Wahhhhhooo' }}
111
+ end
112
+
113
+ it 'should stub'
114
+ stub(a, 'toString').and_return('Oh no')
115
+ stub(b, 'toString').and_return('Oh noooo')
116
+ a.toString().should.eql 'Oh no'
117
+ b.toString().should.eql 'Oh noooo'
118
+ end
119
+
120
+ it 'should restore'
121
+ a.toString().should.eql 'Wahoo'
122
+ b.toString().should.eql 'Wahhhhhooo'
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ describe 'query()'
129
+ it 'should return a pairs value'
130
+ query('suite', '?suite=Positive%20specs').should.equal 'Positive specs'
131
+ end
132
+
133
+ it 'should return null when key is not present'
134
+ query('foo', '?suite=Positive%20specs').should.be_null
135
+ end
136
+ end
137
+
138
+ describe 'strip()'
139
+ it 'should strip whitespace by default'
140
+ strip(" foo \n\n").should.equal 'foo'
141
+ end
142
+
143
+ it 'should strip the characters passed'
144
+ strip('[foo]', '\\[\\]').should.equal 'foo'
145
+ end
146
+ end
147
+
148
+ describe 'each()'
149
+ it 'should iterate an array'
150
+ result = []
151
+ each([1,2,3], function(value){
152
+ result.push(value)
153
+ })
154
+ result.should.eql [1,2,3]
155
+ end
156
+
157
+ it 'should iterate words in a string'
158
+ result = []
159
+ each('some foo bar', function(value){
160
+ result.push(value)
161
+ })
162
+ result.should.eql ['some', 'foo', 'bar']
163
+ end
164
+ end
165
+
166
+ describe 'map()'
167
+ it 'should return an array of mapped values'
168
+ result = map([1,2,3], function(value){
169
+ return value * 2
170
+ })
171
+ result.should.eql [2,4,6]
172
+ end
173
+
174
+ it 'should inherit the ability to iterate words in a string'
175
+ result = map('some foo bar', function(i, value){
176
+ return i + '-' + value
177
+ })
178
+ result.should.eql ['0-some', '1-foo', '2-bar']
179
+ end
180
+ end
181
+
182
+ describe 'inject()'
183
+ it 'should provide a memo object while iterating, not expecting returning of memo for composits'
184
+ result = inject([1,2,3], [], function(memo, value){
185
+ memo.push(value)
186
+ })
187
+ result.should.eql [1,2,3]
188
+ end
189
+
190
+ it 'should require returning of memo for scalar variables'
191
+ result = inject([1,2,3], false, function(memo, value){
192
+ return memo ? memo : value == 2
193
+ })
194
+ result.should.be_true
195
+ end
196
+ end
197
+
198
+ describe 'any()'
199
+ it 'should return null when no matches are found'
200
+ result = any('some foo bar', function(value){
201
+ return value.length > 5
202
+ })
203
+ result.should.be_null
204
+ end
205
+
206
+ it 'should return the value of the first matching expression'
207
+ result = any('foo some bar', function(value){
208
+ return value.length > 3
209
+ })
210
+ result.should.eql 'some'
211
+ end
212
+
213
+ describe 'haveStopped'
214
+ it 'should check if "stop" has been returned by a callback hook'
215
+ any([true, 'stop'], haveStopped).should.eql 'stop'
216
+ any([true, true], haveStopped).should.be_null
217
+ any([true, null], haveStopped).should.be_null
218
+ end
219
+ end
220
+ end
221
+
222
+ describe 'select()'
223
+ it 'should return an array of values when the callback evaluates to true'
224
+ result = select('some foo bar baz stuff', function(value){
225
+ return value.length > 3
226
+ })
227
+ result.should.eql ['some', 'stuff']
228
+ end
229
+ end
230
+
231
+ describe 'last()'
232
+ it 'should return the last element in an array'
233
+ last(['foo', 'bar']).should.eql 'bar'
234
+ end
235
+ end
236
+
237
+ describe 'argumentsToArray()'
238
+ it 'should return an array of arguments'
239
+ func = function(){ return argumentsToArray(arguments) }
240
+ func('foo', 'bar').should.eql ['foo', 'bar']
241
+ end
242
+
243
+ it 'should return the offset of an arguments array'
244
+ func = function(){ return argumentsToArray(arguments, 2) }
245
+ func('foo', 'bar', 'baz').should.eql ['baz']
246
+ end
247
+ end
248
+
249
+ describe 'does()'
250
+ it 'should assert without reporting'
251
+ does('foo', 'eql', 'foo')
252
+ JSpec.currentSpec.assertions.should.have_length 0
253
+ end
254
+ end
255
+
256
+ describe 'contentsOf()'
257
+ it 'should return a function body'
258
+ JSpec.contentsOf(-{ return 'foo' }).should.include 'return', 'foo'
259
+ end
260
+ end
261
+
262
+ describe 'paramsFor()'
263
+ it 'should return an array of function parameter names'
264
+ JSpec.paramsFor(function(foo, bar){}).should.eql ['foo', 'bar']
265
+ end
266
+
267
+ it 'should return only the params for the root function'
268
+ foo = function(bar){
269
+ function baz(test) {}
270
+ var something = function(foo, bar){}
271
+ }
272
+ JSpec.paramsFor(foo).should.eql ['bar']
273
+ end
274
+
275
+ it 'should return empty array when no params are present'
276
+ JSpec.paramsFor(function(){}).should.eql []
277
+ end
278
+ end
279
+ end
data/spec/spec.xhr.js ADDED
@@ -0,0 +1,156 @@
1
+
2
+ describe 'JSpec'
3
+ describe 'Mock XHR'
4
+ before
5
+ responseFrom = function(path) {
6
+ request = new XMLHttpRequest
7
+ request.open('POST', path, false)
8
+ request.send(null)
9
+ return request.responseText
10
+ }
11
+ end
12
+
13
+ it 'should provide snake DSL methods'
14
+ mock_request.should.equal mockRequest
15
+ unmock_request.should.equal unmockRequest
16
+ end
17
+
18
+ it 'should mock XMLHttpRequests if unmockRequest() is called or the spec block has finished'
19
+ original = XMLHttpRequest
20
+ mockRequest().and_return('test')
21
+ XMLHttpRequest.should.not.equal original
22
+ unmockRequest()
23
+ XMLHttpRequest.should.equal original
24
+ end
25
+
26
+ it 'should restore original XMLHttpRequest constructor after each spec'
27
+ XMLHttpRequest.should.not.eql JSpec.XMLHttpRequest
28
+ end
29
+
30
+ describe 'mock response'
31
+ before_each
32
+ mockRequest().and_return('bar', 'text/plain', 200, { 'x-foo' : 'bar' })
33
+ request = new XMLHttpRequest
34
+ request.open('GET', 'path', false, 'foo', 'bar')
35
+ request.send('foo=bar')
36
+ end
37
+
38
+ it 'should allow setting response status'
39
+ mockRequest().and_return('bar', 'text/plain', 404)
40
+ request = new XMLHttpRequest
41
+ request.open('GET', 'path', false)
42
+ request.send(null)
43
+ request.status.should.eql 404
44
+ request.statusText.should.eql 'Not Found'
45
+ end
46
+
47
+ it 'should default readyState to 0'
48
+ request = new XMLHttpRequest
49
+ request.readyState.should.eql 0
50
+ end
51
+
52
+ it 'should populate user'
53
+ request.user.should.eql 'foo'
54
+ end
55
+
56
+ it 'should populate password'
57
+ request.password.should.eql 'bar'
58
+ end
59
+
60
+ it 'should populate method'
61
+ request.method.should.eql 'GET'
62
+ end
63
+
64
+ it 'should populate readyState'
65
+ request.readyState.should.eql 4
66
+ end
67
+
68
+ it 'should populate url'
69
+ request.url.should.eql 'path'
70
+ end
71
+
72
+ it 'should populate status'
73
+ request.status.should.eql 200
74
+ end
75
+
76
+ it 'should populate statusText'
77
+ request.statusText.should.eql 'OK'
78
+ end
79
+
80
+ it 'should populate content type response header'
81
+ request.getResponseHeader('Content-Type').should.eql 'text/plain'
82
+ end
83
+
84
+ it 'should populate Content-Length response header'
85
+ request.getResponseHeader('Content-Length').should.eql 3
86
+ end
87
+
88
+ it 'should populate data'
89
+ request.data.should.eql 'foo=bar'
90
+ end
91
+
92
+ it 'should populate responseText'
93
+ request.responseText.should.eql 'bar'
94
+ end
95
+
96
+ it 'should populate headers'
97
+ request.getResponseHeader('X-Foo').should.eql 'bar'
98
+ end
99
+
100
+ it 'should not interrupt JSpec request related functionality'
101
+ mockRequest().and_return('fail')
102
+ (JSpec.tryLoading('async') || JSpec.tryLoading('spec/async')).should.eql 'cookies!'
103
+ fixture('test').should.eql '<p>test</p>'
104
+ fixture('test.json').should.include '{ user'
105
+ end
106
+
107
+ describe '.onreadystatechange()'
108
+ before_each
109
+ mockRequest().and_return('bar', 'text/plain', 200)
110
+ request = new XMLHttpRequest
111
+ end
112
+
113
+ it 'should be called when opening request in context to the request'
114
+ request.onreadystatechange = function(){
115
+ this.readyState.should.eql 1
116
+ }
117
+ request.open('GET', 'path')
118
+ end
119
+
120
+ it 'should be called when sending request'
121
+ request.open('GET', 'path')
122
+ request.onreadystatechange = function(){
123
+ this.readyState.should.eql 4
124
+ }
125
+ request.send(null)
126
+ end
127
+ end
128
+
129
+ describe '.setRequestHeader()'
130
+ it 'should set request headers'
131
+ mockRequest().and_return('bar', 'text/plain', 200)
132
+ request.open('GET', 'path', false, 'foo', 'bar')
133
+ request.setRequestHeader('Accept', 'foo')
134
+ request.send(null)
135
+ request.requestHeaders['accept'].should.eql 'foo'
136
+ end
137
+ end
138
+
139
+ describe 'HEAD'
140
+ it 'should respond with headers only'
141
+ mockRequest().and_return('bar', 'text/plain', 200)
142
+ request.open('HEAD', 'path', false)
143
+ request.send(null)
144
+ request.responseText.should.be_null
145
+ end
146
+ end
147
+
148
+ describe 'with uri'
149
+ it 'should mock only the uri specified'
150
+ mockRequest('ilike').and_return('cookies')
151
+ responseFrom('async').should.eql 'cookies'
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,4 @@
1
+
2
+ === 0.0.1 / YYYY-MM-DD
3
+
4
+ * Initial release