jspec 2.11.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +522 -0
- data/Manifest +57 -0
- data/README.rdoc +825 -0
- data/Rakefile +75 -0
- data/bin/jspec +305 -0
- data/jspec.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 +145 -0
- data/lib/jspec.jquery.js +71 -0
- data/lib/jspec.js +1771 -0
- data/lib/jspec.shell.js +36 -0
- data/lib/jspec.timers.js +90 -0
- data/lib/jspec.xhr.js +183 -0
- data/server/browsers.rb +228 -0
- data/server/helpers.rb +82 -0
- data/server/routes.rb +57 -0
- data/server/server.rb +88 -0
- data/spec/async +1 -0
- data/spec/env.js +695 -0
- data/spec/fixtures/test.html +1 -0
- data/spec/fixtures/test.json +1 -0
- data/spec/fixtures/test.xml +5 -0
- data/spec/helpers.js +66 -0
- data/spec/server.rb +2 -0
- data/spec/spec.dom.html +34 -0
- data/spec/spec.fixtures.js +18 -0
- data/spec/spec.grammar-less.js +34 -0
- data/spec/spec.grammar.js +226 -0
- data/spec/spec.jquery.js +176 -0
- data/spec/spec.jquery.xhr.js +65 -0
- data/spec/spec.js +166 -0
- data/spec/spec.matchers.js +493 -0
- data/spec/spec.modules.js +67 -0
- data/spec/spec.node.js +46 -0
- data/spec/spec.rhino.js +17 -0
- data/spec/spec.server.html +29 -0
- data/spec/spec.shared-behaviors.js +80 -0
- data/spec/spec.utils.js +279 -0
- data/spec/spec.xhr.js +156 -0
- data/templates/default/History.rdoc +4 -0
- data/templates/default/README.rdoc +29 -0
- data/templates/default/lib/yourlib.core.js +2 -0
- data/templates/default/spec/server.rb +4 -0
- data/templates/default/spec/spec.core.js +8 -0
- data/templates/default/spec/spec.dom.html +20 -0
- data/templates/default/spec/spec.rhino.js +8 -0
- data/templates/default/spec/spec.server.html +16 -0
- data/templates/rails/server.rb +4 -0
- data/templates/rails/spec.application.js +8 -0
- data/templates/rails/spec.dom.html +20 -0
- data/templates/rails/spec.rhino.js +8 -0
- data/templates/rails/spec.server.html +16 -0
- 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!
|