jspec-steventux 3.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/History.md +763 -0
  2. data/Manifest +73 -0
  3. data/README.md +974 -0
  4. data/Rakefile +44 -0
  5. data/bin/jspec +178 -0
  6. data/jspec-steventux.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 +149 -0
  14. data/lib/jspec.growl.js +115 -0
  15. data/lib/jspec.jquery.js +72 -0
  16. data/lib/jspec.js +1756 -0
  17. data/lib/jspec.shell.js +39 -0
  18. data/lib/jspec.timers.js +90 -0
  19. data/lib/jspec.xhr.js +195 -0
  20. data/spec/commands/example_command.rb +19 -0
  21. data/spec/dom.html +33 -0
  22. data/spec/fixtures/test.html +1 -0
  23. data/spec/fixtures/test.json +1 -0
  24. data/spec/fixtures/test.xml +5 -0
  25. data/spec/node.js +17 -0
  26. data/spec/rhino.js +23 -0
  27. data/spec/ruby/bin/init_spec.rb +101 -0
  28. data/spec/ruby/bin/install_spec.rb +142 -0
  29. data/spec/ruby/bin/run_spec.rb +0 -0
  30. data/spec/ruby/bin/shell_spec.rb +13 -0
  31. data/spec/ruby/bin/spec_helper.rb +8 -0
  32. data/spec/ruby/bin/update_spec.rb +72 -0
  33. data/spec/server.html +29 -0
  34. data/spec/server.rb +2 -0
  35. data/spec/support/env.js +10118 -0
  36. data/spec/support/jquery.js +4376 -0
  37. data/spec/unit/helpers.js +64 -0
  38. data/spec/unit/spec.fixtures.js +17 -0
  39. data/spec/unit/spec.grammar-less.js +34 -0
  40. data/spec/unit/spec.grammar.js +241 -0
  41. data/spec/unit/spec.jquery.js +178 -0
  42. data/spec/unit/spec.jquery.xhr.js +84 -0
  43. data/spec/unit/spec.js +187 -0
  44. data/spec/unit/spec.matchers.js +577 -0
  45. data/spec/unit/spec.modules.js +51 -0
  46. data/spec/unit/spec.shared-behaviors.js +80 -0
  47. data/spec/unit/spec.utils.js +346 -0
  48. data/spec/unit/spec.xhr.js +157 -0
  49. data/src/browsers.rb +294 -0
  50. data/src/helpers.rb +67 -0
  51. data/src/installables.rb +229 -0
  52. data/src/project.rb +341 -0
  53. data/src/routes.rb +57 -0
  54. data/src/server.rb +99 -0
  55. data/support/js.jar +0 -0
  56. data/templates/default/History.md +5 -0
  57. data/templates/default/Readme.md +29 -0
  58. data/templates/default/lib/yourlib.js +2 -0
  59. data/templates/default/spec/commands/example_command.rb +19 -0
  60. data/templates/default/spec/dom.html +22 -0
  61. data/templates/default/spec/node.js +10 -0
  62. data/templates/default/spec/rhino.js +10 -0
  63. data/templates/default/spec/server.html +18 -0
  64. data/templates/default/spec/server.rb +4 -0
  65. data/templates/default/spec/unit/spec.helper.js +0 -0
  66. data/templates/default/spec/unit/spec.js +8 -0
  67. data/templates/rails/commands/example_commands.rb +19 -0
  68. data/templates/rails/dom.html +22 -0
  69. data/templates/rails/rhino.js +10 -0
  70. data/templates/rails/server.html +18 -0
  71. data/templates/rails/server.rb +4 -0
  72. data/templates/rails/unit/spec.helper.js +0 -0
  73. data/templates/rails/unit/spec.js +8 -0
  74. metadata +185 -0
@@ -0,0 +1,57 @@
1
+
2
+ get '/jspec/*' do |path|
3
+ send_file JSPEC_ROOT + '/lib/' + path
4
+ end
5
+
6
+ post '/results' do
7
+ require 'json/pure'
8
+ data = JSON.parse request.body.read
9
+ if data['options'].include?('verbose') && data['options']['verbose'] ||
10
+ data['options'].include?('failuresOnly') && data['options']['failuresOnly']
11
+ puts "\n\n %s Passes: %s Failures: %s\n\n" % [
12
+ bold(browser_name),
13
+ green(data['stats']['passes']),
14
+ red(data['stats']['failures'])]
15
+ data['results'].compact.each do |suite|
16
+ specs = suite['specs'].compact.map do |spec|
17
+ case spec['status'].to_sym
18
+ when :pass
19
+ next if data['options'].include?('failuresOnly') && data['options']['failuresOnly']
20
+ ' ' + green(spec['description']) + assertion_graph_for(spec['assertions']).to_s + "\n"
21
+ when :fail
22
+ " #{red(spec['description'])}\n #{spec['message']}\n\n"
23
+ else
24
+ " #{blue(spec['description'])}\n"
25
+ end
26
+ end.join
27
+ unless specs.strip.empty?
28
+ puts "\n " + bold(suite['description'])
29
+ puts specs
30
+ end
31
+ end
32
+ else
33
+ puts "%20s Passes: %s Failures: %s" % [
34
+ bold(browser_name),
35
+ green(data['stats']['passes']),
36
+ red(data['stats']['failures'])]
37
+ end
38
+ halt 200
39
+ end
40
+
41
+ get '/*' do |path|
42
+ pass unless File.exists? path
43
+ send_file path
44
+ end
45
+
46
+ #--
47
+ # Simulation Routes
48
+ #++
49
+
50
+ get '/slow/*' do |seconds|
51
+ sleep seconds.to_i
52
+ halt 200
53
+ end
54
+
55
+ get '/status/*' do |code|
56
+ halt code.to_i
57
+ end
@@ -0,0 +1,99 @@
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
+ Thread.new {
62
+ sleep 10
63
+ browser.teardown
64
+ }
65
+ end.push(Thread.new {
66
+ start!
67
+ }).push(Thread.new {
68
+ sleep 10
69
+ stop!
70
+ }).reverse.each { |thread| thread.join }
71
+ end
72
+
73
+ private
74
+
75
+ #:nodoc:
76
+
77
+ def start!
78
+ Sinatra::Application.class_eval do
79
+ begin
80
+ $stderr.puts 'Started JSpec server at http://%s:%d' % [host, port.to_i]
81
+ detect_rack_handler.run self, :Host => host, :Port => port do |server|
82
+ trap 'INT' do
83
+ server.respond_to?(:stop!) ? server.stop! : server.stop
84
+ end
85
+ end
86
+ rescue Errno::EADDRINUSE
87
+ raise "Port #{port} already in use"
88
+ rescue Errno::EACCES
89
+ raise "Permission Denied on port #{port}"
90
+ end
91
+ end
92
+ end
93
+ def stop!
94
+ puts 'Stopping JSpec server at http://%s:%d' % [host, port.to_i]
95
+ exit 0
96
+ end
97
+
98
+ end
99
+ end
Binary file
@@ -0,0 +1,5 @@
1
+
2
+ 0.0.1 / YYYY-MM-DD
3
+ ------------------
4
+
5
+ * Initial release
@@ -0,0 +1,29 @@
1
+
2
+ # YourLib
3
+
4
+ Description
5
+
6
+ ## License
7
+
8
+ (The MIT License)
9
+
10
+ Copyright (c) 2009 Your Name <Your Email>
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining
13
+ a copy of this software and associated documentation files (the
14
+ 'Software'), to deal in the Software without restriction, including
15
+ without limitation the rights to use, copy, modify, merge, publish,
16
+ distribute, sublicense, and/or sell copies of the Software, and to
17
+ permit persons to whom the Software is furnished to do so, subject to
18
+ the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
27
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+
2
+ // Your library here
@@ -0,0 +1,19 @@
1
+
2
+ # uncomment and call with `$ jspec example `
3
+
4
+ # command :example do |c|
5
+ # c.syntax = 'jspec example [options]'
6
+ # c.description = 'Just an example command'
7
+ # c.option '-f', '--foo string', 'Does some foo with <string>'
8
+ # c.option '-b', '--bar [string]', 'Does some bar with [string]'
9
+ # c.example 'Do some foo', 'jspec example --foo bar'
10
+ # c.example 'Do some bar', 'jspec example --bar'
11
+ # c.when_called do |args, options|
12
+ # p args
13
+ # p options.__hash__
14
+ # # options.foo
15
+ # # options.bar
16
+ # # options.__hash__[:foo]
17
+ # # options.__hash__[:bar]
18
+ # end
19
+ # end
@@ -0,0 +1,22 @@
1
+ <html>
2
+ <head>
3
+ <link type="text/css" rel="stylesheet" href="JSPEC_ROOT/lib/jspec.css" />
4
+ <script src="JSPEC_ROOT/lib/jspec.js"></script>
5
+ <script src="JSPEC_ROOT/lib/jspec.xhr.js"></script>
6
+ <script src="../lib/yourlib.js"></script>
7
+ <script src="unit/spec.helper.js"></script>
8
+ <script>
9
+ function runSuites() {
10
+ JSpec
11
+ .exec('unit/spec.js')
12
+ .run({ fixturePath: 'fixtures' })
13
+ .report()
14
+ }
15
+ </script>
16
+ </head>
17
+ <body class="jspec" onLoad="runSuites();">
18
+ <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
19
+ <div id="jspec"></div>
20
+ <div id="jspec-bottom"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,10 @@
1
+
2
+ require.paths.unshift('spec', 'JSPEC_ROOT/lib', 'lib')
3
+ require('jspec')
4
+ require('unit/spec.helper')
5
+ require('yourlib')
6
+
7
+ JSpec
8
+ .exec('spec/unit/spec.js')
9
+ .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'spec/fixtures' })
10
+ .report()
@@ -0,0 +1,10 @@
1
+
2
+ load('JSPEC_ROOT/lib/jspec.js')
3
+ load('JSPEC_ROOT/lib/jspec.xhr.js')
4
+ load('lib/yourlib.js')
5
+ load('spec/unit/spec.helper.js')
6
+
7
+ JSpec
8
+ .exec('spec/unit/spec.js')
9
+ .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'spec/fixtures' })
10
+ .report()
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <script src="/jspec/jspec.js"></script>
4
+ <script src="/jspec/jspec.xhr.js"></script>
5
+ <script src="/lib/yourlib.js"></script>
6
+ <script src="/spec/unit/spec.helper.js"></script>
7
+ <script>
8
+ function runSuites() {
9
+ JSpec
10
+ .exec('unit/spec.js')
11
+ .run({ reporter: JSpec.reporters.Server, verbose: true, failuresOnly: true, fixturePath: '/spec/fixtures' })
12
+ .report()
13
+ }
14
+ </script>
15
+ </head>
16
+ <body class="jspec" onLoad="runSuites();">
17
+ </body>
18
+ </html>
@@ -0,0 +1,4 @@
1
+
2
+ get '/lib/*' do |path|
3
+ send_file File.dirname(__FILE__) + '/../lib/' + path
4
+ end
@@ -0,0 +1,8 @@
1
+
2
+ describe 'YourLib'
3
+ describe '.someMethod()'
4
+ it 'should do something'
5
+ true.should.be true
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+
2
+ # uncomment and call with `$ jspec example `
3
+
4
+ # command :example do |c|
5
+ # c.syntax = 'jspec example [options]'
6
+ # c.description = 'Just an example command'
7
+ # c.option '-f', '--foo string', 'Does some foo with <string>'
8
+ # c.option '-b', '--bar [string]', 'Does some bar with [string]'
9
+ # c.example 'Do some foo', 'jspec example --foo bar'
10
+ # c.example 'Do some bar', 'jspec example --bar'
11
+ # c.when_called do |args, options|
12
+ # p args
13
+ # p options.__hash__
14
+ # # options.foo
15
+ # # options.bar
16
+ # # options.__hash__[:foo]
17
+ # # options.__hash__[:bar]
18
+ # end
19
+ # end
@@ -0,0 +1,22 @@
1
+ <html>
2
+ <head>
3
+ <link type="text/css" rel="stylesheet" href="JSPEC_ROOT/lib/jspec.css" />
4
+ <script src="JSPEC_ROOT/lib/jspec.js"></script>
5
+ <script src="JSPEC_ROOT/lib/jspec.xhr.js"></script>
6
+ <script src="../public/javascripts/application.js"></script>
7
+ <script src="unit/spec.helper.js"></script>
8
+ <script>
9
+ function runSuites() {
10
+ JSpec
11
+ .exec('unit/spec.js')
12
+ .run({ fixturePath: 'fixtures' })
13
+ .report()
14
+ }
15
+ </script>
16
+ </head>
17
+ <body class="jspec" onLoad="runSuites();">
18
+ <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
19
+ <div id="jspec"></div>
20
+ <div id="jspec-bottom"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,10 @@
1
+
2
+ load('JSPEC_ROOT/lib/jspec.js')
3
+ load('JSPEC_ROOT/lib/jspec.xhr.js')
4
+ load('public/javascripts/application.js')
5
+ load('jspec/unit/spec.helper.js')
6
+
7
+ JSpec
8
+ .exec('jspec/unit/spec.js')
9
+ .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'jspec/fixtures' })
10
+ .report()
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <script src="/jspec/jspec.js"></script>
4
+ <script src="/jspec/jspec.xhr.js"></script>
5
+ <script src="/lib/yourlib.js"></script>
6
+ <script src="/spec/unit/spec.helper.js"></script>
7
+ <script>
8
+ function runSuites() {
9
+ JSpec
10
+ .exec('unit/spec.js')
11
+ .run({ reporter: JSpec.reporters.Server, verbose: true, failuresOnly: true, fixturePath: '/spec/fixtures' })
12
+ .report()
13
+ }
14
+ </script>
15
+ </head>
16
+ <body class="jspec" onLoad="runSuites();">
17
+ </body>
18
+ </html>
@@ -0,0 +1,4 @@
1
+
2
+ get '/public/*' do |path|
3
+ send_file File.dirname(__FILE__) + '/../public/' + path
4
+ end
File without changes
@@ -0,0 +1,8 @@
1
+
2
+ describe 'YourLib'
3
+ describe '.someMethod()'
4
+ it 'should do something'
5
+ true.should.be true
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jspec-steventux
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.3.2
5
+ platform: ruby
6
+ authors:
7
+ - TJ Holowaychuk, S Laing
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-25 00:00:00 +00:00
13
+ default_executable: jspec
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: json_pure
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: commander
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 4.0.1
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: bind
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.2.8
54
+ version:
55
+ description: JavaScript BDD Testing Framework
56
+ email: info@laingsolutions.com
57
+ executables:
58
+ - jspec
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - README.md
63
+ - bin/jspec
64
+ - lib/images/bg.png
65
+ - lib/images/hr.png
66
+ - lib/images/loading.gif
67
+ - lib/images/sprites.bg.png
68
+ - lib/images/sprites.png
69
+ - lib/images/vr.png
70
+ - lib/jspec.css
71
+ - lib/jspec.growl.js
72
+ - lib/jspec.jquery.js
73
+ - lib/jspec.js
74
+ - lib/jspec.shell.js
75
+ - lib/jspec.timers.js
76
+ - lib/jspec.xhr.js
77
+ files:
78
+ - History.md
79
+ - Manifest
80
+ - README.md
81
+ - Rakefile
82
+ - bin/jspec
83
+ - jspec-steventux.gemspec
84
+ - lib/images/bg.png
85
+ - lib/images/hr.png
86
+ - lib/images/loading.gif
87
+ - lib/images/sprites.bg.png
88
+ - lib/images/sprites.png
89
+ - lib/images/vr.png
90
+ - lib/jspec.css
91
+ - lib/jspec.growl.js
92
+ - lib/jspec.jquery.js
93
+ - lib/jspec.js
94
+ - lib/jspec.shell.js
95
+ - lib/jspec.timers.js
96
+ - lib/jspec.xhr.js
97
+ - spec/commands/example_command.rb
98
+ - spec/dom.html
99
+ - spec/fixtures/test.html
100
+ - spec/fixtures/test.json
101
+ - spec/fixtures/test.xml
102
+ - spec/node.js
103
+ - spec/rhino.js
104
+ - spec/ruby/bin/init_spec.rb
105
+ - spec/ruby/bin/install_spec.rb
106
+ - spec/ruby/bin/run_spec.rb
107
+ - spec/ruby/bin/shell_spec.rb
108
+ - spec/ruby/bin/spec_helper.rb
109
+ - spec/ruby/bin/update_spec.rb
110
+ - spec/server.html
111
+ - spec/server.rb
112
+ - spec/support/env.js
113
+ - spec/support/jquery.js
114
+ - spec/unit/helpers.js
115
+ - spec/unit/spec.fixtures.js
116
+ - spec/unit/spec.grammar-less.js
117
+ - spec/unit/spec.grammar.js
118
+ - spec/unit/spec.jquery.js
119
+ - spec/unit/spec.jquery.xhr.js
120
+ - spec/unit/spec.js
121
+ - spec/unit/spec.matchers.js
122
+ - spec/unit/spec.modules.js
123
+ - spec/unit/spec.shared-behaviors.js
124
+ - spec/unit/spec.utils.js
125
+ - spec/unit/spec.xhr.js
126
+ - src/browsers.rb
127
+ - src/helpers.rb
128
+ - src/installables.rb
129
+ - src/project.rb
130
+ - src/routes.rb
131
+ - src/server.rb
132
+ - support/js.jar
133
+ - templates/default/History.md
134
+ - templates/default/Readme.md
135
+ - templates/default/lib/yourlib.js
136
+ - templates/default/spec/commands/example_command.rb
137
+ - templates/default/spec/dom.html
138
+ - templates/default/spec/node.js
139
+ - templates/default/spec/rhino.js
140
+ - templates/default/spec/server.html
141
+ - templates/default/spec/server.rb
142
+ - templates/default/spec/unit/spec.helper.js
143
+ - templates/default/spec/unit/spec.js
144
+ - templates/rails/commands/example_commands.rb
145
+ - templates/rails/dom.html
146
+ - templates/rails/rhino.js
147
+ - templates/rails/server.html
148
+ - templates/rails/server.rb
149
+ - templates/rails/unit/spec.helper.js
150
+ - templates/rails/unit/spec.js
151
+ has_rdoc: true
152
+ homepage: http://github.com/steventux/jspec
153
+ licenses: []
154
+
155
+ post_install_message:
156
+ rdoc_options:
157
+ - --line-numbers
158
+ - --inline-source
159
+ - --title
160
+ - Jspec
161
+ - --main
162
+ - README.md
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: "0"
170
+ version:
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: "1.2"
176
+ version:
177
+ requirements: []
178
+
179
+ rubyforge_project: jspec
180
+ rubygems_version: 1.3.5
181
+ signing_key:
182
+ specification_version: 3
183
+ summary: JavaScript BDD Testing Framework
184
+ test_files: []
185
+