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,157 @@
1
+
2
+ describe 'JSpec'
3
+ describe 'Mock XMLHttpRequest'
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 'last_request()'
31
+ it 'should provide access to the previous request'
32
+ mock_request().and_return('foo')
33
+ responseFrom('async')
34
+ last_request().url.should.eql 'async'
35
+ last_request().status.should.eql 200
36
+ end
37
+ end
38
+
39
+ describe 'mock_request()'
40
+ before_each
41
+ mockRequest().and_return('bar', 'text/plain', 200, { 'x-foo' : 'bar' })
42
+ request = new XMLHttpRequest
43
+ request.open('GET', 'path', false, 'foo', 'bar')
44
+ request.send('foo=bar')
45
+ end
46
+
47
+ it 'should allow setting response status'
48
+ mockRequest().and_return('bar', 'text/plain', 404)
49
+ request = new XMLHttpRequest
50
+ request.open('GET', 'path', false)
51
+ request.send(null)
52
+ request.status.should.eql 404
53
+ request.statusText.should.eql 'Not Found'
54
+ end
55
+
56
+ it 'should default readyState to 0'
57
+ request = new XMLHttpRequest
58
+ request.readyState.should.eql 0
59
+ end
60
+
61
+ it 'should populate user'
62
+ request.user.should.eql 'foo'
63
+ end
64
+
65
+ it 'should populate password'
66
+ request.password.should.eql 'bar'
67
+ end
68
+
69
+ it 'should populate method'
70
+ request.method.should.eql 'GET'
71
+ end
72
+
73
+ it 'should populate readyState'
74
+ request.readyState.should.eql 4
75
+ end
76
+
77
+ it 'should populate url'
78
+ request.url.should.eql 'path'
79
+ end
80
+
81
+ it 'should populate status'
82
+ request.status.should.eql 200
83
+ end
84
+
85
+ it 'should populate statusText'
86
+ request.statusText.should.eql 'OK'
87
+ end
88
+
89
+ it 'should populate content type response header'
90
+ request.getResponseHeader('Content-Type').should.eql 'text/plain'
91
+ end
92
+
93
+ it 'should populate Content-Length response header'
94
+ request.getResponseHeader('Content-Length').should.eql 3
95
+ end
96
+
97
+ it 'should populate data'
98
+ request.data.should.eql 'foo=bar'
99
+ end
100
+
101
+ it 'should populate responseText'
102
+ request.responseText.should.eql 'bar'
103
+ end
104
+
105
+ it 'should populate headers'
106
+ request.getResponseHeader('X-Foo').should.eql 'bar'
107
+ end
108
+
109
+ it 'should not interrupt JSpec request related functionality'
110
+ mockRequest().and_return('fail')
111
+ fixture('test').should.eql '<p>test</p>'
112
+ fixture('test.json').should.include '{ user'
113
+ end
114
+
115
+ describe '.onreadystatechange()'
116
+ before_each
117
+ mockRequest().and_return('bar', 'text/plain', 200)
118
+ request = new XMLHttpRequest
119
+ end
120
+
121
+ it 'should be called when opening request in context to the request'
122
+ request.onreadystatechange = function(){
123
+ this.readyState.should.eql 1
124
+ }
125
+ request.open('GET', 'path')
126
+ end
127
+
128
+ it 'should be called when sending request'
129
+ request.open('GET', 'path')
130
+ request.onreadystatechange = function(){
131
+ this.readyState.should.eql 4
132
+ }
133
+ request.send(null)
134
+ end
135
+ end
136
+
137
+ describe '.setRequestHeader()'
138
+ it 'should set request headers'
139
+ mockRequest().and_return('bar', 'text/plain', 200)
140
+ request.open('GET', 'path', false, 'foo', 'bar')
141
+ request.setRequestHeader('Accept', 'foo')
142
+ request.send(null)
143
+ request.requestHeaders['accept'].should.eql 'foo'
144
+ end
145
+ end
146
+
147
+ describe 'HEAD'
148
+ it 'should respond with headers only'
149
+ mockRequest().and_return('bar', 'text/plain', 200)
150
+ request.open('HEAD', 'path', false)
151
+ request.send(null)
152
+ request.responseText.should.be_null
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,279 @@
1
+
2
+ require 'rbconfig'
3
+
4
+ #--
5
+ # Browser
6
+ #++
7
+
8
+ class Browser
9
+
10
+ ##
11
+ # Check if the user agent _string_ matches this browser.
12
+
13
+ def self.matches_agent? string; end
14
+
15
+ ##
16
+ # Check if the browser matches the name _string_.
17
+
18
+ def self.matches_name? string; end
19
+
20
+ ##
21
+ # Subclasses.
22
+
23
+ def self.subclasses
24
+ @subclasses ||= []
25
+ end
26
+
27
+ ##
28
+ # Stack subclasses.
29
+
30
+ def self.inherited subclass
31
+ subclasses << subclass
32
+ end
33
+
34
+ ##
35
+ # Whether or not the browser is supported.
36
+
37
+ def supported?; true end
38
+
39
+ ##
40
+ # Server setup.
41
+
42
+ def setup; end
43
+
44
+ ##
45
+ # Server teardown.
46
+
47
+ def teardown; end
48
+
49
+ ##
50
+ # Host environment.
51
+
52
+ def host
53
+ Config::CONFIG['host_os']
54
+ end
55
+
56
+ ##
57
+ # Check if we are using macos.
58
+
59
+ def macos?
60
+ host.include? 'darwin'
61
+ end
62
+
63
+ ##
64
+ # Check if we are using windows.
65
+
66
+ def windows?
67
+ host =~ /mswin|mingw/
68
+ end
69
+
70
+ ##
71
+ # Check if we are using linux.
72
+
73
+ def linux?
74
+ host.include? 'linux'
75
+ end
76
+
77
+ ##
78
+ # Run applescript _code_.
79
+
80
+ def applescript code
81
+ raise "Can't run AppleScript on #{host}" unless macos?
82
+ system "osascript -e '#{code}' 2>&1 >/dev/null"
83
+ end
84
+
85
+ #--
86
+ # Default
87
+ #++
88
+
89
+ class Default < self
90
+ def self.matches_name? string
91
+ string =~ /default/i
92
+ end
93
+
94
+ def visit uri
95
+ system 'open', uri if macos?
96
+ system 'start', uri if windows?
97
+ system 'xdg-open', uri if linux?
98
+ end
99
+
100
+ def to_s
101
+ 'Default'
102
+ end
103
+ end
104
+
105
+ #--
106
+ # Firefox
107
+ #++
108
+
109
+ class Firefox < self
110
+ def self.matches_agent? string
111
+ string =~ /firefox/i
112
+ end
113
+
114
+ def self.matches_name? string
115
+ string =~ /ff|firefox|mozilla/i
116
+ end
117
+
118
+ def visit uri
119
+ system "open -g -a Firefox '#{uri}'" if macos?
120
+ system "firefox #{uri}" if linux?
121
+ system "#{File.join(ENV['ProgramFiles'] || 'c:\Program Files', '\Mozilla Firefox\firefox.exe')} #{uri}" if windows?
122
+ end
123
+
124
+ def to_s
125
+ 'Firefox'
126
+ end
127
+ end
128
+
129
+ #--
130
+ # Safari
131
+ #++
132
+
133
+ class Safari < self
134
+ def self.matches_agent? string
135
+ string =~ /safari/i && string !~ /chrome/i
136
+ end
137
+
138
+ def self.matches_name? string
139
+ string =~ /safari/i
140
+ end
141
+
142
+ def supported?
143
+ macos?
144
+ end
145
+
146
+ def setup
147
+ applescript 'tell application "Safari" to make new document'
148
+ end
149
+
150
+ def visit uri
151
+ applescript 'tell application "Safari" to set URL of front document to "' + uri + '"'
152
+ end
153
+
154
+ def matches_agent? string
155
+ string =~ /safari/i
156
+ end
157
+
158
+ def to_s
159
+ 'Safari'
160
+ end
161
+ end
162
+
163
+ #--
164
+ # Chrome
165
+ #++
166
+
167
+ class Chrome < self
168
+ def self.matches_agent? string
169
+ string =~ /chrome/i
170
+ end
171
+
172
+ def self.matches_name? string
173
+ string =~ /google|chrome/i
174
+ end
175
+
176
+ def supported?
177
+ macos? or linux?
178
+ end
179
+
180
+ def visit uri
181
+ system "open -g -a 'Google Chrome' #{uri}" if macos?
182
+ system "google-chrome #{uri}" if linux?
183
+ end
184
+
185
+ def to_s
186
+ 'Chrome'
187
+ end
188
+ end
189
+
190
+ #--
191
+ # WebKit
192
+ #++
193
+
194
+ class WebKit < self
195
+ def self.matches_agent? string
196
+ string =~ / AppleWebKit\/[\d\.]+\+/i
197
+ end
198
+
199
+ def self.matches_name? string
200
+ string =~ /webkit|wk/i
201
+ end
202
+
203
+ def supported?
204
+ macos?
205
+ end
206
+
207
+ def setup
208
+ applescript 'tell application "WebKit" to make new document'
209
+ end
210
+
211
+ def visit uri
212
+ applescript 'tell application "WebKit" to set URL of front document to "' + uri + '"'
213
+ end
214
+
215
+ def to_s
216
+ 'WebKit Nightly'
217
+ end
218
+ end
219
+
220
+ #--
221
+ # Internet Explorer
222
+ #++
223
+
224
+ class IE < self
225
+ def self.matches_agent? string
226
+ string =~ /microsoft/i
227
+ end
228
+
229
+ def self.matches_name? string
230
+ string =~ /ie|explorer/i
231
+ end
232
+
233
+ def supported?
234
+ windows?
235
+ end
236
+
237
+ def setup
238
+ require 'win32ole'
239
+ end
240
+
241
+ def visit uri
242
+ ie = WIN32OLE.new 'InternetExplorer.Application'
243
+ ie.visible = true
244
+ ie.Navigate uri
245
+ while ie.ReadyState != 4 do
246
+ sleep 1
247
+ end
248
+ end
249
+
250
+ def to_s
251
+ 'Internet Explorer'
252
+ end
253
+ end
254
+
255
+ #--
256
+ # Opera
257
+ #++
258
+
259
+ class Opera < self
260
+ def self.matches_agent? string
261
+ string =~ /opera/i
262
+ end
263
+
264
+ def self.matches_name? string
265
+ string =~ /opera/i
266
+ end
267
+
268
+ def visit uri
269
+ system "open -g -a Opera #{uri}" if macos?
270
+ system "c:\Program Files\Opera\Opera.exe #{uri}" if windows?
271
+ system "opera #{uri}" if linux?
272
+ end
273
+
274
+ def to_s
275
+ 'Opera'
276
+ end
277
+ end
278
+
279
+ end
@@ -0,0 +1,67 @@
1
+
2
+ helpers do
3
+
4
+ ##
5
+ # Return dotted assertion graph for _assertions_.
6
+
7
+ def assertion_graph_for assertions
8
+ return if assertions.empty?
9
+ assertions.map do |assertion|
10
+ assertion['passed'] ? green('.') : red('.')
11
+ end.join
12
+ end
13
+
14
+ ##
15
+ # Override Sinatra's #send_file to prevent caching.
16
+
17
+ def send_file *args
18
+ response['Cache-Control'] = 'no-cache'
19
+ super
20
+ end
21
+
22
+ ##
23
+ # Find the browser name for the current user agent.
24
+
25
+ def browser_name
26
+ Browser.subclasses.find do |browser|
27
+ browser.matches_agent? env['HTTP_USER_AGENT']
28
+ end.new
29
+ rescue
30
+ 'Unknown'
31
+ end
32
+
33
+ ##
34
+ # Wrap _string_ with ansi escape sequence using _code_.
35
+
36
+ def color string, code
37
+ "\e[#{code}m#{string}\e[0m"
38
+ end
39
+
40
+ ##
41
+ # Bold _string_.
42
+
43
+ def bold string
44
+ color string, 1
45
+ end
46
+
47
+ ##
48
+ # Color _string_ red.
49
+
50
+ def red string
51
+ color string, 31
52
+ end
53
+
54
+ ##
55
+ # Color _string_ green.
56
+
57
+ def green string
58
+ color string, 32
59
+ end
60
+
61
+ ##
62
+ # Color _string_ blue.
63
+
64
+ def blue string
65
+ color string, 34
66
+ end
67
+ end