bootcamp 0.1.0

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.
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,79 @@
1
+ History.md
2
+ Manifest
3
+ README.md
4
+ Rakefile
5
+ bin/jspec
6
+ jspec.gemspec
7
+ lib/images/bg.png
8
+ lib/images/hr.png
9
+ lib/images/loading.gif
10
+ lib/images/sprites.bg.png
11
+ lib/images/sprites.png
12
+ lib/images/vr.png
13
+ lib/jspec.css
14
+ lib/jspec.growl.js
15
+ lib/jspec.jquery.js
16
+ lib/jspec.js
17
+ lib/jspec.shell.js
18
+ lib/jspec.timers.js
19
+ lib/jspec.xhr.js
20
+ spec/commands/example_command.rb
21
+ spec/dom.html
22
+ spec/fixtures/test.html
23
+ spec/fixtures/test.json
24
+ spec/fixtures/test.xml
25
+ spec/node.js
26
+ spec/rhino.js
27
+ spec/ruby/bin/init_spec.rb
28
+ spec/ruby/bin/install_spec.rb
29
+ spec/ruby/bin/run_spec.rb
30
+ spec/ruby/bin/shell_spec.rb
31
+ spec/ruby/bin/spec_helper.rb
32
+ spec/ruby/bin/update_spec.rb
33
+ spec/server.html
34
+ spec/server.rb
35
+ spec/support/env.js
36
+ spec/support/jquery.js
37
+ spec/unit/helpers.js
38
+ spec/unit/spec.fixtures.js
39
+ spec/unit/spec.grammar-less.js
40
+ spec/unit/spec.grammar.js
41
+ spec/unit/spec.jquery.js
42
+ spec/unit/spec.jquery.xhr.js
43
+ spec/unit/spec.js
44
+ spec/unit/spec.matchers.js
45
+ spec/unit/spec.modules.js
46
+ spec/unit/spec.shared-behaviors.js
47
+ spec/unit/spec.utils.js
48
+ spec/unit/spec.xhr.js
49
+ src/browsers.rb
50
+ src/helpers.rb
51
+ src/installables.rb
52
+ src/project.rb
53
+ src/routes.rb
54
+ src/server.rb
55
+ support/js.jar
56
+ templates/default/History.md
57
+ templates/default/Readme.md
58
+ templates/default/lib/yourlib.js
59
+ templates/default/spec/commands/example_command.rb
60
+ templates/default/spec/dom.html
61
+ templates/default/spec/node.js
62
+ templates/default/spec/rhino.js
63
+ templates/default/spec/server.html
64
+ templates/default/spec/server.rb
65
+ templates/default/spec/unit/spec.helper.js
66
+ templates/default/spec/unit/spec.js
67
+ templates/node/History.md
68
+ templates/node/Readme.md
69
+ templates/node/lib/yourlib.js
70
+ templates/node/spec/node.js
71
+ templates/node/spec/unit/spec.helper.js
72
+ templates/node/spec/unit/spec.js
73
+ templates/rails/commands/example_commands.rb
74
+ templates/rails/dom.html
75
+ templates/rails/rhino.js
76
+ templates/rails/server.html
77
+ templates/rails/server.rb
78
+ templates/rails/unit/spec.helper.js
79
+ templates/rails/unit/spec.js
@@ -0,0 +1,1030 @@
1
+
2
+ # JSpec
3
+
4
+ JSpec is a minimalistic JavaScript behavior driven development framework,
5
+ providing **simple installation**, extremely **low learning curve**, absolutely **no pollution**
6
+ to core prototypes, async request support, and incredibly sexy syntax, tons of matchers
7
+ and **much more**.
8
+
9
+ ## Features
10
+
11
+ * Highly readable
12
+ * Framework / DOM independent
13
+ * Modular via JSpec Module's and hooks
14
+ * Mock Ajax Requests
15
+ * Rhino support
16
+ * Node.js support
17
+ * Async support
18
+ * Growl (unobtrustive notifications) support
19
+ * Fixture support
20
+ * Ruby JavaScript testing server
21
+ * Nested describes
22
+ * Does not pollute core object prototypes
23
+ * Cascading before/after/before_each/after_each hooks
24
+ * Extremely simple and intuitive matcher declaration
25
+ * Over 45 core matchers
26
+ * Allows parens to be optional when using matchers to increase readability
27
+ * Several helpful reporters (DOM, Terminal, ...)
28
+ * Assertion graphs displaying how many, and which assertions pass or failed
29
+ * Default / customizable evaluation contexts
30
+ * DOM sandbox support
31
+ * Great looking default DOM theme
32
+ * `jspec` command-line utility for auto-running specs, and initializing project templates
33
+ * Proxy or 'Spy' assertions
34
+ * Method Stubbing
35
+ * Shared behaviors
36
+ * Extend the jspec executable with project / user specific sub-commands.
37
+ * Profiling
38
+ * Interactive Shell
39
+ * Ruby on Rails Integration
40
+ * Install support projects with a single command (jQuery, Rhino, Prototype, Dojo, etc)
41
+ * Tiny (2000-ish LOC)
42
+
43
+ ## Companies Using JSpec
44
+
45
+ To add or request removal from this list please email tj@vision-media.ca
46
+
47
+ * [Apple](http://apple.com)
48
+ * [Google - YouTube](http://youtube.com)
49
+ * [Palm](http://palm.com)
50
+ * [Carfax](http://carfax.com)
51
+ * [Apache CouchDB](http://couchdb.apache.org)
52
+ * [Vision Media](http://vision-media.ca)
53
+
54
+ ## Installation
55
+
56
+ Simply download JSpec and include _JSpec.css_ and _JSpec.js_ in your markup.
57
+ Head over to the downloads section on Github, clone this public repo, or
58
+ add JSpec as a git submodule with in your project. Alternatively JSpec is
59
+ also available as a Ruby Gem (though this is not required), which also
60
+ provides the `jspec` executable. First install [Gemcutter](http://gemcutter.org/) then execute:
61
+ $ sudo gem install jspec
62
+
63
+ At which point you may:
64
+
65
+ $ jspec init myproject
66
+
67
+ By default, the command above will use absolute path for all JSpec library files.
68
+ This behavior can be a problem when you're working across different computers or
69
+ operating systems. You can freeze the library or symlink it.
70
+
71
+ $ jspec init myproject --freeze
72
+ $ jspec init myproject --symlink
73
+
74
+ JSpec scripts should NOT be referenced via the `<script>` tag, they should be
75
+ loaded using the exec method (**unless you are using the grammar-less alternative**).
76
+ Below is an example:
77
+
78
+ ...
79
+ <script>
80
+ function runSuites() {
81
+ JSpec
82
+ .exec('spec.core.js')
83
+ .exec('spec.jquery.js')
84
+ .run({ failuresOnly : true })
85
+ .report()
86
+ }
87
+ </script>
88
+ <body onLoad="runSuites()">
89
+ ...
90
+
91
+ You may optionally want to use sources in the _/pkg_ directory
92
+ for your project, since it includes compressed alternatives generated
93
+ each release.
94
+
95
+ ## Example
96
+
97
+ describe 'ShoppingCart'
98
+ before_each
99
+ cart = new ShoppingCart
100
+ end
101
+
102
+ describe 'addProducts'
103
+ it 'should add several products'
104
+ cart.addProduct('cookie')
105
+ cart.addProduct('icecream')
106
+ cart.should.have 2, 'products'
107
+ end
108
+ end
109
+
110
+ describe 'checkout'
111
+ it 'should throw an error when checking out with no products'
112
+ -{ cart.clear().checkout() }.should.throw_error EmptyCart
113
+ end
114
+ end
115
+ end
116
+
117
+ ## Grammar-less Example
118
+
119
+ JSpec's grammar is optional, you may also use the equivalent grammar-less
120
+ alternative below using pure JavaScript (when using the JSpec grammar you
121
+ may also use grammar-less assertions):
122
+
123
+ JSpec.describe('ShoppingCart', function(){
124
+ before_each(function{
125
+ cart = new ShoppingCart
126
+ })
127
+
128
+ describe('addProducts', function(){
129
+ it ('should add several products', function(){
130
+ cart.addProducts('cookie')
131
+ cart.addProducts('icecream')
132
+ expect(cart).to(have, 2, 'products')
133
+ })
134
+ })
135
+
136
+ describe('checkout', function(){
137
+ it ('should throw an error when checking out with no products', function(){
138
+ expect(function(){ cart.clear().checkout() }).to(throw_error, EmptyCart)
139
+ })
140
+ })
141
+ })
142
+
143
+ ## Options
144
+
145
+ The following options may be passed to _JSpec.run()_.
146
+
147
+ - fixturePath
148
+ - {string} path to fixture directory (DOM, Terminal, Server)
149
+ - failuresOnly
150
+ - {bool} displays only failing specs, making them quick to discover and fix (DOM, Terminal, Server)
151
+ - reportToId
152
+ - {string} an element id to report to when using the DOM reporter (DOM)
153
+ - verbose
154
+ - {bool} verbose server output, defaults to false (Server)
155
+
156
+ ## Matchers
157
+
158
+ ### Core
159
+
160
+ - equal, be
161
+ - ===
162
+ - be_a, be_an
163
+ - have constructor of x
164
+ - be_an_instance_of
165
+ - instanceof x
166
+ - be_at_least
167
+ - &gt;=
168
+ - be_at_most
169
+ - &lt;=
170
+ - be_null
171
+ - == null
172
+ - be_empty
173
+ - length &lt; 0 or {}
174
+ - be_true
175
+ - == true
176
+ - be_false
177
+ - == false
178
+ - be_type
179
+ - be type of x
180
+ - be_greater_than
181
+ - &gt;
182
+ - be_less_than
183
+ - &lt;
184
+ - be_undefined
185
+ - check if variable passed is undefined
186
+ - throw_error
187
+ - should throw an error, optionally supply the error string or regexp for message comparison
188
+ - have
189
+ - object should have n of property (person.should.have(2, 'pets'))
190
+ - have_at_least
191
+ - object should have at least n of property
192
+ - have_at_most
193
+ - object should have a maximum n of property
194
+ - have_within
195
+ - object should have within n..n of property (person.should.have_within(1..3, 'pets')
196
+ - have_length
197
+ - length of n
198
+ - have_prop
199
+ - object should have property x, optionally supplying an expected value
200
+ - have_property
201
+ - strict version of have_prop
202
+ - be_within
203
+ - checks if n is within the range passed
204
+ - include
205
+ - include substring, array element, or hash key
206
+ - match
207
+ - string should match regexp x
208
+ - respond_to
209
+ - property x should be a function
210
+ - eql
211
+ - matches simple literals (strings, numbers) with ==
212
+ However composites like arrays or 'hashes' are recursively matched,
213
+ meaning that [1, 2, [3]].should_eql([1, 2, [3]]) will be true.
214
+
215
+ ### jQuery
216
+
217
+ - have_tag, have_one
218
+ - have exactly one tag
219
+ - have_tags, have_many
220
+ - have more than one tag
221
+ - have_child
222
+ - have exactly one child
223
+ - have_children
224
+ - have more than one child
225
+ - have_text
226
+ - have plain text
227
+ - have_attr
228
+ - have an attribute, with optional value
229
+ - have_type
230
+ - have_id
231
+ - have_title
232
+ - have_alt
233
+ - have_href
234
+ - have_rel
235
+ - have_rev
236
+ - have_name
237
+ - have_target
238
+ - have_value
239
+ - have_class
240
+ - have_classes
241
+ - be_visible
242
+ - be_hidden
243
+ - be_enabled
244
+ - be_disabled
245
+ - be_selected
246
+ - be_checked
247
+
248
+ ## Growl Support
249
+
250
+ JSpec uses the [JavaScript Growl](http://github.com/visionmedia/js-growl) library to provide
251
+ growl support when using the **Rhino JavaScript engine**. To enable simply `load()` _jspec.growl.js_
252
+ within _spec/rhino.js_
253
+
254
+ ## Async Support With Mock Timers
255
+
256
+ The javascript mock timers library is available at [http://github.com/visionmedia/js-mock-timers](http://github.com/visionmedia/js-mock-timers)
257
+ although it is already bundled with JSpec at _lib/jspec.timers.js_
258
+
259
+ Timers return ids and may be passed to `clearInterval()`, however
260
+ they do not execute in threads, they must be manually scheduled and
261
+ controlled via the `tick()` function.
262
+
263
+ setTimeout(function(){
264
+ alert('Wahoo!')
265
+ }, 400)
266
+
267
+ tick(200) // Nothing happens
268
+ tick(400) // Wahoo!
269
+
270
+ `setInterval()` works as expected, although it persists, where as `setTimeout()`
271
+ is destroyed after a single call. As conveyed by the last `tick()` call below,
272
+ a large increment in milliseconds may cause the callbacks to be called several times
273
+ to 'catch up'.
274
+
275
+ progress = ''
276
+ var id = setInterval(function(){
277
+ progress += '.'
278
+ }, 100)
279
+
280
+ tick(50), print(progress) // ''
281
+ tick(50), print(progress) // '.'
282
+ tick(100), print(progress) // '..'
283
+ tick(100), print(progress) // '...'
284
+ tick(300), print(progress) // '......'
285
+
286
+ clearInterval(id)
287
+
288
+ tick(800) // Nothing happens
289
+
290
+ You may also reset at any time using resetTimers()
291
+
292
+ ## Proxy Assertions
293
+
294
+ Proxy or 'Spy' assertions allow you to assert that a method is called n number
295
+ of times, with x arguments, returning x value. For example:
296
+
297
+ person = { getPets : function(species){ return ['izzy'] }}
298
+ person.should.receive('getPets', 'twice').with_args(an_instance_of(String))and_return(['izzy'])
299
+ person.getPets('dog') // This will pass
300
+ person.getPets() // This will fail because we asked an instance of String
301
+
302
+ This is a useful mechanism for testing the behavior of your object, as well as
303
+ how other methods may interact with it. Below is another example:
304
+
305
+ array = ['foo', 'bar']
306
+ array.should.receive('toString').and_return('foo,bar')
307
+ 'array: ' + array // This line causes the spec to pass due to calling toString()
308
+
309
+ For more examples view _spec/spec.matchers.js_
310
+
311
+ ## Method Stubbing
312
+
313
+ JSpec currently provides very simple stubbing support shown below:
314
+
315
+ person = { toString : function(){ return '<Person>' } }
316
+ stub(person, 'toString').and_return('Ive been stubbed!')
317
+
318
+ After each spec all stubs are restored to their original methods so
319
+ there is no reason to explicitly call `destub()`. To persist stubs,
320
+ use a before_each hook:
321
+
322
+ before_each
323
+ stub(someObject, 'method').and_return({ some : thing })
324
+ end
325
+
326
+ To destub a method simply call `destub()` at any time:
327
+
328
+ destub(person, 'toString')
329
+
330
+ If you would like to whipe an object clear of stubs simply pass it
331
+ to `destub()` without an additional method argument:
332
+
333
+ destub(person)
334
+
335
+ Alternatively both these utility functions may be called as methods
336
+ on any object when using the JSpec grammar:
337
+
338
+ someObject.stub('method').and_return('whatever')
339
+ // Converted to stub(someObject, 'method').and_return('whatever')
340
+
341
+ ## Helpers
342
+
343
+ * core
344
+
345
+ - an_instance_of
346
+ - used in conjunction with the 'receive' matcher
347
+
348
+ * jspec.xhr.js
349
+ - mockRequest, mock_request
350
+ - mock a request
351
+ - unmockRequest, unmock_request
352
+ - unmock requests
353
+ - lastRequest, last_request
354
+ - access previous request data
355
+
356
+ * jspec.jquery.js
357
+
358
+ - sandbox
359
+ - used to generate new DOM sandbox, using jQuery object
360
+ - element
361
+ - same as invoking jQuery, just reads better and no need to worry about $ collisions
362
+ - elements
363
+ - alias of element
364
+
365
+ ## Shared Behaviors
366
+
367
+ JSpec's support for shared behaviors allows multiple suites or describe blocks to share
368
+ common functionality, including specs and hooks. Shared functionality is run in the order in
369
+ which it is included in the hosting suite. For example a canine would inherit all
370
+ behavior of an animal, and particular breeds of dog would inherit all behavior from the canine.
371
+ Note that as in the poodle example, shared behaviors can be nested inside suites or describe
372
+ blocks and will be visible only to other describe blocks _at or below_ the same nesting level.
373
+
374
+ shared_behaviors_for 'animal'
375
+ before
376
+ animal = { eats: function(){return true }}
377
+ end
378
+
379
+ it 'should eat'
380
+ animal.eats().should.eql true
381
+ end
382
+ end
383
+
384
+ shared_behaviors_for 'canine'
385
+ should_behave_like('animal')
386
+
387
+ before
388
+ animal.hasFourLegs = function(){ return true }
389
+ animal.barks = function(){ return true }
390
+ end
391
+
392
+ it 'should have 4 legs'
393
+ animal.hasFourLegs().should.eql true
394
+ end
395
+
396
+ it 'should bark'
397
+ animal.barks().should.eql true
398
+ end
399
+ end
400
+
401
+ describe 'mastif'
402
+ should_behave_like('canine')
403
+
404
+ before
405
+ animal.weight = 200
406
+ end
407
+
408
+ it 'should weigh > 100 lbs'
409
+ animal.weight.should.be_greater_than 100
410
+ end
411
+ end
412
+
413
+ describe 'poodle breeds'
414
+ should_behave_like('canine')
415
+
416
+ shared_behaviors_for 'poodle'
417
+ before
418
+ animal.isMean = true
419
+ end
420
+
421
+ it 'should be mean'
422
+ animal.isMean.should.eql true
423
+ end
424
+ end
425
+
426
+ describe 'fancy poodle'
427
+ should_behave_like('poodle')
428
+
429
+ before
430
+ animal.looksRidiculous = true
431
+ end
432
+
433
+ it 'should look ridiculous'
434
+ animal.looksRidiculous.should.eql true
435
+ end
436
+ end
437
+ end
438
+
439
+ NOTE: When the should_behave_like() call is searching for behaviors to include, it works inside out.
440
+ Therefore any nested shared behaviors by the same name as a shared behavior at a higher
441
+ nesting level will override the one at the higher level.
442
+
443
+
444
+ ## Mock Ajax Requests
445
+
446
+ JSpec supports generic Ajax mocking which is usable with any JavaScript framework via _jspec.xhr.js_. The
447
+ API is comprised of two functions, `mock_request()` and `unmock_request()`. `unmock_request()` is
448
+ automatically called after each specification to restore the default functionality of XMLHttpRequest,
449
+ so it is uncommon to call `unmock_request()` directly. Below is a jQuery example:
450
+
451
+ it 'should mock requests'
452
+ mock_request().and_return('{ foo : "bar" }', 'application/json')
453
+ $.getJSON('foo', function(response, statusText){
454
+ response.foo.should.eql 'bar'
455
+ })
456
+ end
457
+
458
+ The mock_request().and_return signature is as follows:
459
+
460
+ mock_request().and_return(<data>, [content-type], [response-status-code], [headers-hash])
461
+
462
+ At the moment `mock_request()` itself does not accept any arguments, however in the future
463
+ this will be used to target specific uris for mocking.
464
+
465
+ **NOTE**: works with Rhino as well
466
+
467
+ ## Hooks
468
+
469
+ Currently the following hooks are supported, and may be utilized any number of times as they
470
+ are simply pushed to a stack. So for instance you may have two before_each blocks within the same
471
+ scope, they will both run, but this can help keep your specs readable.
472
+
473
+ - before
474
+ - run once before the suite is executed
475
+ - after
476
+ - run once after the suite is executed
477
+ - before_each
478
+ - run before each specification
479
+ - after_each
480
+ - run after each specification
481
+ - before_nested
482
+ - run once before the suite and once before any nested suites
483
+ - after_nested
484
+ - run once after the suite and once after any nested suites
485
+
486
+ ## Custom Contexts
487
+
488
+ Custom contexts can be applied to supply helper
489
+ methods or properties to all subsequent bodies (other hooks, or specs).
490
+
491
+ Keep in mind that when replacing the default context you will loose
492
+ functionality provided by it, unless you manually merge it with your
493
+ custom context.
494
+
495
+ To reset the context simply assign null to obtain the original context.
496
+
497
+ ...
498
+ before
499
+ JSpec.context = { foo : 'bar' }
500
+ end
501
+
502
+ after
503
+ JSpec.context = null
504
+ end
505
+
506
+ it 'will work ;)'
507
+ foo.should_equal 'bar'
508
+ end
509
+ ...
510
+
511
+ ## Async Support
512
+
513
+ Currently only _jspec.jquery.js_ supports async requests. JSpec uses `jQuery.ajaxSetup` and sets all
514
+ requests to sync, which preserves execution order, and reports correctly.
515
+
516
+ it 'should load mah cookies (textfile)'
517
+ $.post('async', function(text){
518
+ text.should_eql 'cookies!'
519
+ })
520
+ end
521
+
522
+ ## Grammer Pre-processor
523
+
524
+ The pre-processing capability of JSpec is extremely powerful. Your JavaScript
525
+ code is not necessarily what it seems. For example when you seemingly invoke a
526
+ object's prototype like below:
527
+
528
+ 'foobar'.should.include 'bar'
529
+
530
+ First parens are added:
531
+
532
+ 'foobar'.should.include('bar')
533
+
534
+ Secondly the matcher invocation is converted to a non-polluting match() call:
535
+
536
+ expect('foobar').to(include, 'bar')
537
+
538
+ This also means instead of:
539
+
540
+ var object = { foo : 'bar' }
541
+ object.should.include 'foo'
542
+
543
+ We can do:
544
+
545
+ { foo : 'bar' }.should.include 'foo'
546
+
547
+ ### Closure Literal
548
+
549
+ These are equivalent:
550
+
551
+ -{ throw 'test' }.should.throw_error
552
+ function() { throw 'test' }.should.throw_error
553
+
554
+ ### Inclusive Range Literal
555
+
556
+ The following expands to the array of [1,2,3,4,5]
557
+
558
+ n.should.be_within 1..5
559
+
560
+ ### __END__
561
+
562
+ Any text placed after **__END__** is considered irrelevant and
563
+ is striped out before evaluation. This is sometimes useful for
564
+ document or code reference while writing specs.
565
+
566
+ For example when writting regression specs it is sometimes useful
567
+ to paste the issue ticket's comment(s) below this area for reference.
568
+
569
+ ## Formatters
570
+
571
+ To change a reporter simply alter the options hash like below, assigning
572
+ a new constructor, or pass it within the hash to `run()`:
573
+
574
+ JSpec.options.reporter = JSpec.reporters.Terminal
575
+
576
+ OR
577
+
578
+ JSpec
579
+ .exec('...')
580
+ .run({ reporter: JSpec.reporters.Terminal })
581
+ .report()
582
+
583
+ ## Fixtures
584
+
585
+ The `fixture()` utility function may be used in order to load arbitrary file contents
586
+ for use with your specifications. JSpec will resolve `fixture('data')` in the following
587
+ manor:
588
+
589
+ - <fixturePath>/data
590
+ - <fixturePath>/data.html
591
+
592
+ In order for the `fixture()` utility to function you must pass the **fixturePath** option
593
+ to _JSpec.run()_ which provides JSpec with the fixture directory.
594
+
595
+ The `json_fixture()` utility works much the same as `fixture()` however `fixture('data')`
596
+ will be parsed as JSON, and resolved as shown below:
597
+
598
+ - <fixturePath>/data
599
+ - <fixturePath>/data.json
600
+
601
+ ## Testing DOM Elements
602
+
603
+ When using jQuery testing DOM elements is very easy. Many may think they require specific
604
+ sandbox divs in their html, however you do not. Using the fixture support mentioned above
605
+ you may simply load some HTML, and use the `elements()` utility which is an alias of jQuery:
606
+
607
+ describe 'JSpec DOM testing'
608
+ describe 'is so easy'
609
+ before_each
610
+ list = elements(fixture('users-list'))
611
+ // or list = jQuery(fixture('users-list'))
612
+ // or list = $(fixture('users-list'))
613
+ end
614
+
615
+ it 'should have users'
616
+ list.should.have_tag 'ul'
617
+ end
618
+ end
619
+ end
620
+
621
+ You may also use simple strings, since jQuery's constructor will convert them to DOM elements:
622
+
623
+ describe 'Something'
624
+ before_each
625
+ html = elements('<p>Foo</p>')
626
+ // or html = $('<p>Foo</p>') ...
627
+ end
628
+
629
+ it 'should do something'
630
+ html.should.have_text 'Foo'
631
+ end
632
+ end
633
+
634
+ ## Custom Matchers
635
+
636
+ First lets create a simple equality matcher. In the case below JSpec is smart enough to realize
637
+ this is simply a binary operator, and simply transforms this into `actual === expected`
638
+
639
+ JSpec.addMatchers({
640
+ equal : '==='
641
+ })
642
+
643
+ To alias a method to keep your specs readable you may alias them like below:
644
+
645
+ JSpec.addMatchers({
646
+ be : 'alias equal'
647
+ })
648
+
649
+ 'foo'.should.equal 'foo'
650
+ true.should.be true
651
+
652
+ Matchers with string bodies implicitly return the expression value.
653
+ The expanded version of the equal matcher would then be:
654
+
655
+ JSpec.addMatchers({
656
+ equal : 'actual === expected'
657
+ })
658
+
659
+ Large matchers or those which require several parameters may wish
660
+ to utilize the hash method:
661
+
662
+ JSpec.addMatchers({
663
+ equal : { match : function(actual, expected){
664
+ return actual === expected
665
+ }}
666
+ })
667
+
668
+ To keep JSpec tiny, JSpec will default to generating failure messages
669
+ for you, how ever this can be explicitly defined:
670
+
671
+ JSpec.addMatchers({
672
+ equal : {
673
+ match : function(actual, expected){
674
+ return actual === expected
675
+ },
676
+ message : function(actual, expected, negate) {
677
+ return 'a message here'
678
+ }
679
+ }
680
+ })
681
+
682
+ When defining matchers that are extremely similar in functionality, however
683
+ require different names, you may use a prefixed list of words like below which
684
+ defines be_disabled, be_selected, be_checked, and have_type, have_id, etc. Each
685
+ function must return the matcher body which will be used.
686
+
687
+ JSpec.addMatchers({
688
+ 'be disabled selected checked' : function(attr) {
689
+ return 'jQuery(actual).attr("' + attr + '")'
690
+ },
691
+
692
+ 'have type id title alt href src sel rev name target' : function(attr) {
693
+ return function(actual, value) {
694
+ return value ? jQuery(actual).attr(attr) ## value:
695
+ jQuery(actual).attr(attr)
696
+ }
697
+ }
698
+ })
699
+
700
+ ## Extending Or Hooking Into JSpec
701
+
702
+ JSpec provides a hook architecture for extending or analyzing various
703
+ points in its execution, through the use of modules. For a module
704
+ example view _lib/jspec.jquery.js_.
705
+
706
+ The following methods or properties are utilized by JSpec:
707
+
708
+ - name : module name string
709
+ - init : called to initialize a module
710
+ - reporters : hash of reporters merged with JSpec.reporters
711
+ - utilities : hash of utility functions merged with JSpec.defaultContext
712
+ - matchers : hash of matchers merged with JSpec's core matchers via JSpec.addMatchers()
713
+ - DSLs : hash of DSL methods; for example DSLs.snake contains before_each, after_each, etc.
714
+ Where as DSLs.camel may contain beforeEach, afterEach, etc.
715
+
716
+ Below is a list of hooks, descriptions, and valid return values which
717
+ may simply be implemented as module methods. beforeSuite, afterSuite, beforeSpec, and afterSpec have lower
718
+ precedence than before_each, after_each etc within the specs themselves, allowing them to override or undo
719
+ anything that has been done by a Module.
720
+
721
+ - running(options) : started running JSpec with the options passed : returning 'stop' will halt running
722
+ - loading(file) : loading a file : returning 'stop' will prevent loading
723
+ - executing(file) : executing a file : returning 'stop' will prevent execution
724
+ - posting(data, url) : posting data to a url : returning 'stop' will prevent request
725
+ - preprocessing(input) : before input string is preprocessed : return input string for next hook to preprocess
726
+ - stubbing(object, method, result) : called when stubbing an object's method, and return value (result). : (no return value)
727
+ - requiring(dependency, message) : requiring a dependency : (no return value)
728
+ - beforeAssertion(assertion) : before an assertion has been made : (no return value)
729
+ - afterAssertion(assertion) : after an assertion has been made : (no return value)
730
+ - addingMatcher(name, body) : unprocessed matcher name and body : (no return value)
731
+ - addingSuite(suite) : adding Suite instance to JSpec : (no return value)
732
+ - beforeSuite(suite) : before running of suite (describe block) : (no return value)
733
+ - afterSuite(suite) : after running of suite (describe block) : (no return value)
734
+ - beforeSpec(spec) : before running of spec (it block) : (no return value)
735
+ - afterSpec(spec) : after running of spec (it block) : (no return value)
736
+ - reporting(options) : called before reporting : (no return value)
737
+ - evaluatingBody(dsl, matchers, context, contents) : evaluating body contents, with the given context, matchers and dsl. : (no return value)
738
+
739
+ For example you may wish to proxy files which are being executed, simply implement the
740
+ executing method like below. This example will stop execution of any file matching /matchers/.
741
+
742
+ MyModule = {
743
+ executing : function(file) {
744
+ if (file.match(/matchers/))
745
+ return 'stop'
746
+ }
747
+ }
748
+ JSpec.include(MyModule)
749
+
750
+ Immutable values may also be passed to hooks using hookImmutable() internally. This allows
751
+ for simple numbers, strings, etc to be utilized or altered within a hook implementation. Below
752
+ is an example module which adds functionality to the JSpec grammar by converting `SomeObject.stub('method')`
753
+ to `stub(SomeObject, 'method')`:
754
+
755
+ JSpec.include({
756
+ preprocessing : function(input) {
757
+ return input.replace(/(\w+)\.(stub|destub)\((.*?)\)$/gm, '$2($1, $3)')
758
+ }
759
+ })
760
+
761
+ ## JSpec Command-line Utility
762
+
763
+ When installed as a Ruby Gem, the `jspec` executable will become available,
764
+ allowing you to initialize project templates quickly, as well as auto-testing
765
+ specifications when a file is altered.
766
+
767
+ Initialize JSpec-driven project template in directory _myproject_:
768
+ $ jspec init myproject
769
+
770
+ Once within 'myproject' start testing by executing:
771
+ $ jspec
772
+
773
+ For additional usage execute:
774
+ $ jspec help
775
+
776
+ Or for specific usage:
777
+ $ jspec help run
778
+
779
+ ## Extending JSpec's Executable
780
+
781
+ Both project specific, and user specific sub-commands may be used to
782
+ extend those already provided by `jspec`. For example create the following
783
+ in spec/commands/example_command.rb which are loaded when `jspec` is executed.
784
+
785
+ command :example do |c|
786
+ c.syntax = 'jspec example [options]'
787
+ c.description = 'Just an example command'
788
+ c.option '-f', '--foo string', 'Does some foo with <string>'
789
+ c.option '-b', '--bar [string]', 'Does some bar with [string]'
790
+ c.example 'Do some foo', 'jspec example --foo bar'
791
+ c.example 'Do some bar', 'jspec example --bar'
792
+ c.when_called do |args, options|
793
+ p args
794
+ p options.__hash__
795
+ # options.foo
796
+ # options.bar
797
+ # options.__hash__[:foo]
798
+ # options.__hash__[:bar]
799
+ end
800
+ end
801
+
802
+ And execute with:
803
+
804
+ `$ jspec example`
805
+
806
+ They may also be placed at ~/jspec/commands for global usage.
807
+
808
+ For more information on the command creation visit http://visionmedia.github.com/commander
809
+
810
+ ## Installing Support Projects
811
+
812
+ Lets say you need jQuery for your project, and wish to test against it. You could download
813
+ jQuery manually, use an absolute uri to Google's CDN, or use the following command, which will
814
+ install jQuery to _spec/support/jquery.js_.
815
+ $ jspec install jquery
816
+
817
+ Alternatively we may specify the destination path:
818
+ $ jspec install jquery spec/jquery.js
819
+
820
+ Or provide a specific version string:
821
+ $ jspec install jquery --release 1.3.1
822
+
823
+ The install command will also install Rhino for you (**MacOS only**) so you
824
+ can run specs, and js via the command-line.
825
+ $ jspec install rhino
826
+
827
+ To view the current projects supported view:
828
+ $ jspec help install
829
+
830
+ ## Rhino
831
+
832
+ JSpec provides transparent support for Rhino, while using the Terminal reporter.
833
+ Simply create a JavaScript file with contents similar to below, and then execute
834
+ the command following it:
835
+
836
+ load('lib/jspec.js')
837
+
838
+ JSpec
839
+ .exec('spec/spec.grammar.js')
840
+ .exec('spec/spec.core.js')
841
+ .run({ reporter: JSpec.reporters.Terminal, failuresOnly: true })
842
+ .report()
843
+
844
+ Initialize project with:
845
+ $ jspec init myproject
846
+
847
+ Run with:
848
+ $ jspec run --rhino
849
+
850
+ Or bind (automated testing):
851
+ $ jspec --rhino
852
+
853
+ ## Server
854
+
855
+ The Ruby JavaScript testing server included with JSpec simply runs
856
+ the spec suites within each browser you specify, while reporting result
857
+ back to the terminal. It is essentially the same as using the DOM reporter
858
+ and auto-testing each browser, however results are centralized to the terminal,
859
+ removing the need to manually view each browser's output.
860
+
861
+ When utilizing the server if a file named _spec/jspec.rb_ (or _jspec/jspec.rb_ for rails)
862
+ is present, then it will be loaded before the server is started. This allows you to
863
+ add Sinatra routes, support additional Browsers, etc.
864
+
865
+ Run with all supported browsers:
866
+ $ jspec run --server
867
+
868
+ Run with specific browsers:
869
+ $ jspec run --browsers Safari,Firefox,Chrome,Explorer
870
+
871
+ Run with alternative browser names:
872
+ $ jspec run --browsers safari,ff,chrome,ie
873
+
874
+ Browsers supported in core:
875
+
876
+ - Browser::Default (system default)
877
+ - Browser::Safari
878
+ - Browser::WebKit
879
+ - Browser::Chrome
880
+ - Browser::Firefox
881
+ - Browser::Opera
882
+ - Browser::IE
883
+
884
+ Supplied routes:
885
+
886
+ - /slow/NUMBER
887
+ - /status/NUMBER
888
+
889
+ For example `$.get('/slow/4', function(){})` will take 4 seconds
890
+ to reply, where as `$.get('/status/404', function(){})` will respond
891
+ with an 404 status code. Add additional Sinatra routes to the jspec.rb
892
+ file to add your own functionality.
893
+
894
+ ## Interactive Shell
895
+
896
+ JSpec provides an interactive shell through Rhino, utilize with:
897
+
898
+ $ jspec shell
899
+
900
+ Or to specify additional files to load:
901
+
902
+ $ jspec shell lib/*.js
903
+
904
+ Or view additional shell help
905
+
906
+ $ jspec help shell
907
+
908
+ When running the shell JSpec provides several commands:
909
+
910
+ - quit, exit
911
+ - Terminate the shell session
912
+ - p()
913
+ - Inspect the object passed
914
+
915
+ Or add your own. In the examples below, `foo` will become a getter, so it can
916
+ be invoked simply as `$ foo ` where as `bar` is a regular function which must be called
917
+ as `$ bar("something") `.
918
+
919
+ Shell.commands.foo = ['Does some foo', function(){ return 'something' }]
920
+ Shell.commands.bar = ['Does some bar', function(o){ return 'something' }]
921
+
922
+ ## Ruby on Rails
923
+
924
+ No additional gems are required for JSpec to work with rails, although
925
+ [jspec-rails](http://github.com/bhauman/jspec-rails) has been created by 'bhauman'. JSpec
926
+ supports Rails out of the box, simply execute:
927
+
928
+ $ jspec init --rails
929
+
930
+ Then while still in the root directory of your Rails project, run the following
931
+ command which will bind to, and refresh your browsers automatically when any changes
932
+ are made to _./public/javascripts/*.js_ or _./jspec/*.js_
933
+
934
+ $ jspec
935
+
936
+ Or just like regular JSpec applications, run once:
937
+
938
+ $ jspec run
939
+
940
+ Or run via the terminal using Rhino:
941
+
942
+ $ jspec run --rhino
943
+
944
+ ## Supported Browsers
945
+
946
+ Browsers below are supported and can be found in _server/browsers.rb_, however
947
+ your _spec/server.rb_ file may support additional browsers.
948
+
949
+ - Safari
950
+ - WebKit
951
+ - Chrome
952
+ - Firefox
953
+ - Opera
954
+ - Internet Explorer
955
+
956
+ ## Known Issues
957
+
958
+ - The preprocessor is not (yet) capable of multiline conversions. For example the following is invalid
959
+
960
+ object.stub('getContentsOfURL').and_return(function(url){
961
+ return 'html'
962
+ })
963
+
964
+ In cases such as this, you may always revert to utilizing JSpec in a grammar-less form as follows:
965
+
966
+ stub(object, 'getContentsOfURL').and_return(function(url){
967
+ return 'html'
968
+ })
969
+
970
+ ## Additional JSpec Modules
971
+
972
+ - JSocka stubbing http://github.com/gisikw/jsocka/tree/master
973
+
974
+ ## More Information
975
+
976
+ - [Google Group](http://groups.google.com/group/jspec)
977
+ - IRC Channel [irc://irc.freenode.net#jspec](irc://irc.freenode.net#jspec)
978
+ - Featured in Devmag ["Advanced JavaScript"](http://www.dev-mag.com/2010/02/18/advanced-javascript/) ebook for 4$
979
+ - Featured article in JSMag [http://www.jsmag.com/main.issues.description/id=21/](http://www.jsmag.com/main.issues.description/id=21/)
980
+ - Syntax comparison with other frameworks [http://gist.github.com/92283](http://gist.github.com/92283)
981
+ - Get the TextMate bundle at [https://github.com/visionmedia/jspec.tmbundle/tree](https://github.com/visionmedia/jspec.tmbundle/tree)
982
+ - For more information consult the JSpec source code documentation or visit [http://visionmedia.github.com/jspec](http://visionmedia.github.com/jspec)
983
+ - jQuery + HTML fixture example [http://gist.github.com/147831](http://gist.github.com/147831)
984
+ - [http://twitter.com/tjholowaychuk](Twitter)
985
+ - [JSpec Vim Snippits](http://github.com/tobiassvn/snipmate-jspec/)
986
+
987
+ ## Contributors
988
+
989
+ Many ideas and bug reports were contributed by
990
+ the following developers, thankyou for making
991
+ JSpec more enjoyable, and bug free. If I have
992
+ missed you on this list please let me know
993
+ (aka the fellow who donated [jspec.info](http://jspec.info))
994
+
995
+ - Lawrence Pit
996
+ - [mpd@jesters-court.ne](mpd@jesters-court.ne)
997
+ - [Sarah Brown](brown.sarah.v@gmail.com)
998
+ - [kevin.gisi@gmail.com](kevin.gisi@gmail.com)
999
+ - [tony_t_tubbs@yahoo.com](tony_t_tubbs@yahoo.com)
1000
+ - [enno84@gmx.net](enno84@gmx.net)
1001
+ - swalke16
1002
+ - fnando
1003
+ - Tobias Svensson
1004
+
1005
+ ## License
1006
+
1007
+ (The MIT License)
1008
+
1009
+ Copyright (c) 2008 - 2010 TJ Holowaychuk <tj@vision-media.ca>
1010
+
1011
+ Permission is hereby granted, free of charge, to any person obtaining
1012
+ a copy of this software and associated documentation files (the
1013
+ 'Software'), to deal in the Software without restriction, including
1014
+ without limitation the rights to use, copy, modify, merge, publish,
1015
+ distribute, sublicense, and/or sell copies of the Software, and to
1016
+ permit persons to whom the Software is furnished to do so, subject to
1017
+ the following conditions:
1018
+
1019
+ The above copyright notice and this permission notice shall be
1020
+ included in all copies or substantial portions of the Software.
1021
+
1022
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1023
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1024
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1025
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1026
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1027
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1028
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1029
+
1030
+