webr 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/README.md +4 -0
  2. data/Rakefile +19 -0
  3. data/app/webr.rb +57 -0
  4. data/bin/webr +6 -0
  5. data/ext/jasmine/lib/jasmine.js +2423 -0
  6. data/ext/jsdom/lib/jsdom.js +70 -0
  7. data/ext/jsdom/lib/jsdom/browser/domtohtml.js +198 -0
  8. data/ext/jsdom/lib/jsdom/browser/htmlencoding.js +381 -0
  9. data/ext/jsdom/lib/jsdom/browser/htmltodom.js +151 -0
  10. data/ext/jsdom/lib/jsdom/browser/index.js +484 -0
  11. data/ext/jsdom/lib/jsdom/level1/core.js +1610 -0
  12. data/ext/jsdom/lib/jsdom/level2/core.js +406 -0
  13. data/ext/jsdom/lib/jsdom/level2/events.js +358 -0
  14. data/ext/jsdom/lib/jsdom/level2/html.js +1424 -0
  15. data/ext/jsdom/lib/jsdom/level2/index.js +7 -0
  16. data/ext/jsdom/lib/jsdom/level2/languages/javascript.js +17 -0
  17. data/ext/jsdom/lib/jsdom/level3/core.js +514 -0
  18. data/ext/jsdom/lib/jsdom/level3/events.js +296 -0
  19. data/ext/jsdom/lib/jsdom/level3/html.js +5 -0
  20. data/ext/jsdom/lib/jsdom/level3/index.js +7 -0
  21. data/ext/node-htmlparser/lib/node-htmlparser.js +769 -0
  22. data/ext/node-htmlparser/lib/node-htmlparser.min.js +22 -0
  23. data/ext/request/request.js +116 -0
  24. data/js/jasmine-start.js +10 -0
  25. data/js/webr.js +97 -0
  26. data/jspec/jasmine_spec.js +23 -0
  27. data/lib/webr.rb +17 -0
  28. data/lib/webr/browser.rb +44 -0
  29. data/lib/webr/jasmine.rb +6 -0
  30. data/lib/webr/jasmine/browser.rb +15 -0
  31. data/lib/webr/jasmine/reporter.rb +16 -0
  32. data/lib/webr/jasmine/reporter/base.rb +40 -0
  33. data/lib/webr/jasmine/reporter/console.rb +79 -0
  34. data/lib/webr/jasmine/reporter/html.rb +179 -0
  35. data/lib/webr/portal.rb +19 -0
  36. data/lib/webr/runtime.rb +23 -0
  37. data/lib/webr/version.rb +3 -0
  38. data/spec/data/plain.html +13 -0
  39. data/spec/data/script-embedded.html +17 -0
  40. data/spec/data/script-external-onload.html +11 -0
  41. data/spec/data/script-external-onload.js +11 -0
  42. data/spec/data/script-external.html +11 -0
  43. data/spec/data/script-external.js +1 -0
  44. data/spec/data/script-jquery-1.4.2.html +12 -0
  45. data/spec/data/script-jquery-1.4.3.html +12 -0
  46. data/spec/data/script-jquery.js +3 -0
  47. data/spec/lib/webr/browser_spec.rb +133 -0
  48. data/spec/lib/webr/jasmine/browser_spec.rb +22 -0
  49. data/spec/lib/webr/jasmine/reporter/html_spec.rb +15 -0
  50. data/spec/spec_helper.rb +4 -0
  51. data/tasks/spec.rake +16 -0
  52. data/webr.gemspec +30 -0
  53. metadata +207 -0
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+
3
+ describe Webr::Jasmine::Browser do
4
+
5
+ it "requires an existing format to instantiate" do
6
+ lambda { Webr::Jasmine::Browser.new('foo') }.should raise_error("Undefined reporter: foo")
7
+ class Webr::Jasmine::Reporter::FooBar; end
8
+ lambda { Webr::Jasmine::Browser.new('foo_bar') }.should_not raise_error
9
+ end
10
+
11
+ context "in general" do
12
+ before(:all) do
13
+ @browser = Webr::Jasmine::Browser.new('base')
14
+ @browser.start
15
+ end
16
+
17
+ it "loads jasmine" do
18
+ @browser.env['jasmine'].should_not be_nil
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper')
2
+
3
+ describe Webr::Jasmine::Reporter::Html do
4
+
5
+ it "should create valid textmate links for a backtrace" do
6
+ reporter = Webr::Jasmine::Reporter::Html.new(nil)
7
+ reporter.textmate_backtrace("at [object Object].<anonymous> (/Users/Daniel/playground/webr/jspec/foo_spec.js:14:15)").should ==
8
+ "at [object Object].<anonymous> (<a href=\"txmt://open?url=file:///Users/Daniel/playground/webr/jspec/foo_spec.js&line=14\">/Users/Daniel/playground/webr/jspec/foo_spec.js:14</a>:15)"
9
+ reporter.textmate_backtrace("at /Users/Daniel/.rvm/gems/ruby-1.8.7-p302/gems/rednode-0.1.0/ext/node/src/node.js:764:9").should ==
10
+ "at <a href=\"txmt://open?url=file:///Users/Daniel/.rvm/gems/ruby-1.8.7-p302/gems/rednode-0.1.0/ext/node/src/node.js&line=764\">/Users/Daniel/.rvm/gems/ruby-1.8.7-p302/gems/rednode-0.1.0/ext/node/src/node.js:764</a>:9"
11
+ end
12
+
13
+ end
14
+
15
+
@@ -0,0 +1,4 @@
1
+ require 'lib/webr'
2
+
3
+ DATA_PATH = File.expand_path(File.dirname(__FILE__) + '/data')
4
+ EXT_PATH = File.expand_path(File.dirname(__FILE__) + '/../ext')
@@ -0,0 +1,16 @@
1
+
2
+ begin
3
+ require 'rspec/core/rake_task'
4
+ desc "run rspecs"
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.rspec_opts = ["-c", "-f progress"]
7
+ t.pattern = 'spec/**/*_spec.rb'
8
+ end
9
+ rescue LoadError => e
10
+ desc "run rspecs (I can't get the rspec/core/rake_task to load... bug in rspec?)"
11
+ task :spec do
12
+ puts "install rspec to run rake specs"
13
+ end
14
+ end
15
+
16
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require 'set'
3
+ require 'webr/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'webr'
7
+ s.version = Webr::VERSION
8
+ s.summary = "Pain-free javascript testing"
9
+ s.description = "Test your javascript with no server, no browser, just pleasure."
10
+ s.authors = ["Daniël van de Burgt"]
11
+ s.email = "secretlymexico@gmail.com"
12
+ s.require_paths = ['lib']
13
+ s.executables = ["webr"]
14
+ s.add_dependency('therubyracer', '0.9.0.beta5')
15
+ s.add_dependency('rednode', '>= 0.1.0')
16
+ s.add_dependency('eventmachine')
17
+ s.add_dependency('optitron')
18
+ s.add_development_dependency('rake')
19
+ s.add_development_dependency('rspec')
20
+
21
+ s.files = Set.new.tap do |fileset|
22
+ fileset.add 'Rakefile'
23
+ fileset.add 'README.md'
24
+ fileset.add 'webr.gemspec'
25
+ fileset.add 'ext/jasmine/lib/jasmine.js'
26
+ for dir in %w(app bin js lib spec jspec tasks ext/jsdom/lib ext/node-htmlparser/lib ext/request)
27
+ fileset.merge `cd #{dir} && git ls-files`.split("\n").map {|f| "#{dir}/#{f}"}
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webr
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 5
10
+ version: 0.0.5
11
+ platform: ruby
12
+ authors:
13
+ - "Dani\xC3\xABl van de Burgt"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-31 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ hash: 62196281
28
+ segments:
29
+ - 0
30
+ - 9
31
+ - 0
32
+ - beta
33
+ - 5
34
+ version: 0.9.0.beta5
35
+ prerelease: false
36
+ type: :runtime
37
+ requirement: *id001
38
+ name: therubyracer
39
+ - !ruby/object:Gem::Dependency
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 1
49
+ - 0
50
+ version: 0.1.0
51
+ prerelease: false
52
+ type: :runtime
53
+ requirement: *id002
54
+ name: rednode
55
+ - !ruby/object:Gem::Dependency
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ prerelease: false
66
+ type: :runtime
67
+ requirement: *id003
68
+ name: eventmachine
69
+ - !ruby/object:Gem::Dependency
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ prerelease: false
80
+ type: :runtime
81
+ requirement: *id004
82
+ name: optitron
83
+ - !ruby/object:Gem::Dependency
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ prerelease: false
94
+ type: :development
95
+ requirement: *id005
96
+ name: rake
97
+ - !ruby/object:Gem::Dependency
98
+ version_requirements: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ prerelease: false
108
+ type: :development
109
+ requirement: *id006
110
+ name: rspec
111
+ description: Test your javascript with no server, no browser, just pleasure.
112
+ email: secretlymexico@gmail.com
113
+ executables:
114
+ - webr
115
+ extensions: []
116
+
117
+ extra_rdoc_files: []
118
+
119
+ files:
120
+ - spec/spec_helper.rb
121
+ - spec/data/script-external.html
122
+ - spec/data/plain.html
123
+ - lib/webr/jasmine.rb
124
+ - app/webr.rb
125
+ - spec/data/script-jquery.js
126
+ - spec/data/script-embedded.html
127
+ - ext/request/request.js
128
+ - ext/node-htmlparser/lib/node-htmlparser.js
129
+ - ext/jsdom/lib/jsdom/level3/events.js
130
+ - ext/jsdom/lib/jsdom/level2/index.js
131
+ - jspec/jasmine_spec.js
132
+ - lib/webr/version.rb
133
+ - lib/webr/portal.rb
134
+ - lib/webr/jasmine/reporter.rb
135
+ - ext/jsdom/lib/jsdom/level2/events.js
136
+ - spec/lib/webr/jasmine/reporter/html_spec.rb
137
+ - spec/lib/webr/jasmine/browser_spec.rb
138
+ - spec/lib/webr/browser_spec.rb
139
+ - lib/webr/jasmine/reporter/html.rb
140
+ - lib/webr/runtime.rb
141
+ - lib/webr.rb
142
+ - ext/jasmine/lib/jasmine.js
143
+ - ext/jsdom/lib/jsdom/level3/index.js
144
+ - ext/jsdom/lib/jsdom/level2/languages/javascript.js
145
+ - ext/jsdom/lib/jsdom/browser/htmlencoding.js
146
+ - ext/jsdom/lib/jsdom.js
147
+ - spec/data/script-jquery-1.4.3.html
148
+ - spec/data/script-external.js
149
+ - spec/data/script-external-onload.js
150
+ - spec/data/script-external-onload.html
151
+ - README.md
152
+ - Rakefile
153
+ - ext/jsdom/lib/jsdom/level3/core.js
154
+ - ext/jsdom/lib/jsdom/level1/core.js
155
+ - spec/data/script-jquery-1.4.2.html
156
+ - lib/webr/jasmine/reporter/base.rb
157
+ - bin/webr
158
+ - webr.gemspec
159
+ - ext/jsdom/lib/jsdom/level3/html.js
160
+ - ext/jsdom/lib/jsdom/level2/core.js
161
+ - ext/jsdom/lib/jsdom/browser/index.js
162
+ - tasks/spec.rake
163
+ - lib/webr/jasmine/reporter/console.rb
164
+ - js/jasmine-start.js
165
+ - ext/jsdom/lib/jsdom/level2/html.js
166
+ - ext/jsdom/lib/jsdom/browser/htmltodom.js
167
+ - ext/jsdom/lib/jsdom/browser/domtohtml.js
168
+ - ext/node-htmlparser/lib/node-htmlparser.min.js
169
+ - lib/webr/jasmine/browser.rb
170
+ - lib/webr/browser.rb
171
+ - js/webr.js
172
+ has_rdoc: true
173
+ homepage:
174
+ licenses: []
175
+
176
+ post_install_message:
177
+ rdoc_options: []
178
+
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ hash: 3
187
+ segments:
188
+ - 0
189
+ version: "0"
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ requirements: []
200
+
201
+ rubyforge_project:
202
+ rubygems_version: 1.6.2
203
+ signing_key:
204
+ specification_version: 3
205
+ summary: Pain-free javascript testing
206
+ test_files: []
207
+