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
data/server/server.rb ADDED
@@ -0,0 +1,88 @@
1
+
2
+ $:.unshift File.dirname(__FILE__)
3
+
4
+ require 'sinatra'
5
+ require 'thread'
6
+ require 'browsers'
7
+ require 'helpers'
8
+ require 'routes'
9
+
10
+ module JSpec
11
+ class Server
12
+
13
+ ##
14
+ # Suite HTML.
15
+
16
+ attr_accessor :suite
17
+
18
+ ##
19
+ # Host string.
20
+
21
+ attr_reader :host
22
+
23
+ ##
24
+ # Port number.
25
+
26
+ attr_reader :port
27
+
28
+ ##
29
+ # Server instance.
30
+
31
+ attr_reader :server
32
+
33
+ ##
34
+ # Initialize.
35
+
36
+ def initialize suite, port
37
+ @suite, @port, @host = suite, port, :localhost
38
+ end
39
+
40
+ ##
41
+ # URI formed by the given host and port.
42
+
43
+ def uri
44
+ 'http://%s:%d' % [host, port]
45
+ end
46
+
47
+ ##
48
+ # Start the server with _browsers_ which defaults to all supported browsers.
49
+
50
+ def start browsers = nil
51
+ browsers ||= Browser.subclasses.map { |browser| browser.new }
52
+ browsers.map do |browser|
53
+ Thread.new {
54
+ sleep 1
55
+ if browser.supported?
56
+ browser.setup
57
+ browser.visit uri + '/' + suite
58
+ browser.teardown
59
+ end
60
+ }
61
+ end.push(Thread.new {
62
+ start!
63
+ }).reverse.each { |thread| thread.join }
64
+ end
65
+
66
+ private
67
+
68
+ #:nodoc:
69
+
70
+ def start!
71
+ Sinatra::Application.class_eval do
72
+ begin
73
+ $stderr.puts 'Started JSpec server at http://%s:%d' % [host, port.to_i]
74
+ detect_rack_handler.run self, :Host => host, :Port => port do |server|
75
+ trap 'INT' do
76
+ server.respond_to?(:stop!) ? server.stop! : server.stop
77
+ end
78
+ end
79
+ rescue Errno::EADDRINUSE
80
+ raise "Port #{port} already in use"
81
+ rescue Errno::EACCES
82
+ raise "Permission Denied on port #{port}"
83
+ end
84
+ end
85
+ end
86
+
87
+ end
88
+ end
data/spec/async ADDED
@@ -0,0 +1 @@
1
+ cookies!