screw-unit-server 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/CHANGES +5 -0
  2. data/README.markdown +347 -0
  3. data/Rakefile +70 -0
  4. data/bin/screw_unit +6 -0
  5. data/bin/screw_unit_server +10 -0
  6. data/core/EXAMPLE.html +68 -0
  7. data/core/LICENSE +22 -0
  8. data/core/README.markdown +307 -0
  9. data/core/TODO +2 -0
  10. data/core/example/models/cat.js +5 -0
  11. data/core/example/models/man.js +17 -0
  12. data/core/example/spec/matchers/have.js +8 -0
  13. data/core/example/spec/models/cat_spec.js +31 -0
  14. data/core/example/spec/models/man_spec.js +34 -0
  15. data/core/example/spec/spec_helper.js +5 -0
  16. data/core/example/spec/suite.html +25 -0
  17. data/core/lib/jquery-1.2.3.js +3408 -0
  18. data/core/lib/jquery.fn.js +29 -0
  19. data/core/lib/jquery.print.js +108 -0
  20. data/core/lib/screw.assets.js +36 -0
  21. data/core/lib/screw.behaviors.js +91 -0
  22. data/core/lib/screw.builder.js +80 -0
  23. data/core/lib/screw.css +90 -0
  24. data/core/lib/screw.events.js +38 -0
  25. data/core/lib/screw.matchers.js +65 -0
  26. data/core/lib/screw.server.js +21 -0
  27. data/core/spec/behaviors_spec.js +178 -0
  28. data/core/spec/matchers_spec.js +93 -0
  29. data/core/spec/print_spec.js +119 -0
  30. data/core/spec/spec_helper.js +0 -0
  31. data/core/spec/suite.html +18 -0
  32. data/init.rb +0 -0
  33. data/lib/screw_unit.rb +26 -0
  34. data/lib/screw_unit/resources.rb +2 -0
  35. data/lib/screw_unit/resources/spec.rb +37 -0
  36. data/spec/functional/functional_spec.rb +14 -0
  37. data/spec/functional/functional_spec_helper.rb +55 -0
  38. data/spec/functional_suite.rb +10 -0
  39. data/spec/spec_suite.rb +3 -0
  40. data/spec/unit/js_test_core/specs/spec_dir_spec.rb +43 -0
  41. data/spec/unit/js_test_core/specs/spec_file_spec.rb +43 -0
  42. data/spec/unit/unit_spec_helper.rb +120 -0
  43. data/spec/unit_suite.rb +10 -0
  44. data/vendor/js-test-core/CHANGES +9 -0
  45. data/vendor/js-test-core/README +12 -0
  46. data/vendor/js-test-core/Rakefile +72 -0
  47. data/vendor/js-test-core/lib/js_test_core.rb +30 -0
  48. data/vendor/js-test-core/lib/js_test_core/client.rb +50 -0
  49. data/vendor/js-test-core/lib/js_test_core/rack.rb +2 -0
  50. data/vendor/js-test-core/lib/js_test_core/rack/commonlogger.rb +5 -0
  51. data/vendor/js-test-core/lib/js_test_core/rails_server.rb +22 -0
  52. data/vendor/js-test-core/lib/js_test_core/resources.rb +11 -0
  53. data/vendor/js-test-core/lib/js_test_core/resources/dir.rb +52 -0
  54. data/vendor/js-test-core/lib/js_test_core/resources/file.rb +32 -0
  55. data/vendor/js-test-core/lib/js_test_core/resources/file_not_found.rb +15 -0
  56. data/vendor/js-test-core/lib/js_test_core/resources/runners.rb +15 -0
  57. data/vendor/js-test-core/lib/js_test_core/resources/runners/firefox_runner.rb +75 -0
  58. data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_dir.rb +50 -0
  59. data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_file.rb +17 -0
  60. data/vendor/js-test-core/lib/js_test_core/resources/suite.rb +24 -0
  61. data/vendor/js-test-core/lib/js_test_core/resources/suite_finish.rb +19 -0
  62. data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +62 -0
  63. data/vendor/js-test-core/lib/js_test_core/selenium.rb +2 -0
  64. data/vendor/js-test-core/lib/js_test_core/selenium/selenium_driver.rb +5 -0
  65. data/vendor/js-test-core/lib/js_test_core/server.rb +111 -0
  66. data/vendor/js-test-core/lib/js_test_core/thin.rb +3 -0
  67. data/vendor/js-test-core/lib/js_test_core/thin/backends/js_test_core_server.rb +9 -0
  68. data/vendor/js-test-core/lib/js_test_core/thin/js_test_core_connection.rb +42 -0
  69. data/vendor/js-test-core/spec/example_core/JsTestCore.css +0 -0
  70. data/vendor/js-test-core/spec/example_core/JsTestCore.js +0 -0
  71. data/vendor/js-test-core/spec/example_public/favicon.ico +0 -0
  72. data/vendor/js-test-core/spec/example_public/javascripts/foo.js +3 -0
  73. data/vendor/js-test-core/spec/example_public/robots.txt +0 -0
  74. data/vendor/js-test-core/spec/example_public/stylesheets/example.css +3 -0
  75. data/vendor/js-test-core/spec/example_specs/failing_spec.js +5 -0
  76. data/vendor/js-test-core/spec/example_specs/foo/failing_spec.js +6 -0
  77. data/vendor/js-test-core/spec/example_specs/foo/passing_spec.js +6 -0
  78. data/vendor/js-test-core/spec/spec_suite.rb +2 -0
  79. data/vendor/js-test-core/spec/specs/failing_spec.js +0 -0
  80. data/vendor/js-test-core/spec/unit/js_test_core/client_spec.rb +137 -0
  81. data/vendor/js-test-core/spec/unit/js_test_core/rails_server_spec.rb +45 -0
  82. data/vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb +42 -0
  83. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_not_found_spec.rb +26 -0
  84. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb +88 -0
  85. data/vendor/js-test-core/spec/unit/js_test_core/resources/runner_spec.rb +24 -0
  86. data/vendor/js-test-core/spec/unit/js_test_core/resources/runners/firefox_runner_spec.rb +197 -0
  87. data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_dir_spec.rb +79 -0
  88. data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb +42 -0
  89. data/vendor/js-test-core/spec/unit/js_test_core/resources/suite_finish_spec.rb +94 -0
  90. data/vendor/js-test-core/spec/unit/js_test_core/resources/suite_spec.rb +44 -0
  91. data/vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb +103 -0
  92. data/vendor/js-test-core/spec/unit/js_test_core/server_spec.rb +131 -0
  93. data/vendor/js-test-core/spec/unit/thin/js_test_core_connection_spec.rb +92 -0
  94. data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +125 -0
  95. data/vendor/js-test-core/spec/unit_suite.rb +10 -0
  96. metadata +186 -0
@@ -0,0 +1,125 @@
1
+ require "rubygems"
2
+ require "spec"
3
+
4
+ dir = File.dirname(__FILE__)
5
+ $LOAD_PATH.unshift "#{dir}/../../lib"
6
+ require "js_test_core"
7
+ require "hpricot"
8
+ require "guid"
9
+
10
+ Spec::Runner.configure do |config|
11
+ config.mock_with :rr
12
+ end
13
+
14
+ module Spec
15
+ module Matchers
16
+ class Exist
17
+ def matches?(actual)
18
+ @actual = actual
19
+ !@actual.nil?
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ class Spec::Example::ExampleGroup
26
+ class << self
27
+ def thin_logging
28
+ @thin_logging = true if @thin_logging.nil?
29
+ @thin_logging
30
+ end
31
+
32
+ attr_writer :thin_logging
33
+ end
34
+ end
35
+
36
+ class JsTestCoreTestDir < JsTestCore::Resources::Dir
37
+ def get(request, response)
38
+
39
+ end
40
+ end
41
+
42
+ module Spec::Example::ExampleMethods
43
+ attr_reader :core_path, :spec_root_path, :implementation_root_path, :public_path, :server, :connection
44
+ before(:all) do
45
+ dir = File.dirname(__FILE__)
46
+ @core_path = File.expand_path("#{dir}/../example_core")
47
+ JsTestCore.core_path = core_path
48
+ @spec_root_path = File.expand_path("#{dir}/../example_specs")
49
+ @implementation_root_path = File.expand_path("#{dir}/../example_public/javascripts")
50
+ @public_path = File.expand_path("#{dir}/../example_public")
51
+ end
52
+
53
+ before(:each) do
54
+ JsTestCore::Server.instance = JsTestCore::Server.new(spec_root_path, implementation_root_path, public_path)
55
+ stub(EventMachine).run do
56
+ raise "You need to mock calls to EventMachine.run or the process will hang"
57
+ end
58
+ stub(EventMachine).start_server do
59
+ raise "You need to mock calls to EventMachine.start_server or the process will hang"
60
+ end
61
+ stub(EventMachine).send_data do
62
+ raise "Calls to EventMachine.send_data must be mocked or stubbed"
63
+ end
64
+ @connection = Thin::JsTestCoreConnection.new(Guid.new)
65
+ stub(EventMachine).send_data {raise "EventMachine.send_data must be handled"}
66
+ stub(EventMachine).close_connection {raise "EventMachine.close_connection must be handled"}
67
+ @server = JsTestCore::Server.instance
68
+ Thin::Logging.silent = !self.class.thin_logging
69
+ Thin::Logging.debug = self.class.thin_logging
70
+ end
71
+
72
+ after(:each) do
73
+ JsTestCore::Resources::WebRoot.dispatch_strategy = nil
74
+ Thin::Logging.silent = true
75
+ Thin::Logging.debug = false
76
+ end
77
+
78
+ def get(url, params={})
79
+ request(:get, url, params)
80
+ end
81
+
82
+ def post(url, params={})
83
+ request(:post, url, params)
84
+ end
85
+
86
+ def put(url, params={})
87
+ request(:put, url, params)
88
+ end
89
+
90
+ def delete(url, params={})
91
+ request(:delete, url, params)
92
+ end
93
+
94
+ def env_for(method, url, params)
95
+ Rack::MockRequest.env_for(url, params.merge({:method => method.to_s.upcase, 'js_test_core.connection' => connection}))
96
+ end
97
+
98
+ def create_request(method, url, params={})
99
+ env = env_for(method, url, params)
100
+ server.call(env)[2]
101
+ end
102
+ alias_method :request, :create_request
103
+
104
+ def spec_file(relative_path)
105
+ absolute_path = spec_root_path + relative_path
106
+ JsTestCore::Resources::File.new(absolute_path, "/specs#{relative_path}")
107
+ end
108
+
109
+ def spec_dir(relative_path="")
110
+ absolute_path = spec_root_path + relative_path
111
+ JsTestCore::Resources::Specs::SpecDir.new(absolute_path, "/specs#{relative_path}")
112
+ end
113
+
114
+ def contain_spec_file_with_correct_paths(path_relative_to_spec_root)
115
+ expected_absolute_path = spec_root_path + path_relative_to_spec_root
116
+ expected_relative_path = "/specs" + path_relative_to_spec_root
117
+
118
+ ::Spec::Matchers::SimpleMatcher.new(expected_relative_path) do |globbed_files|
119
+ file = globbed_files.find do |file|
120
+ file.absolute_path == expected_absolute_path
121
+ end
122
+ file && file.relative_path == expected_relative_path
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,10 @@
1
+ class UnitSuite
2
+ def run
3
+ dir = File.dirname(__FILE__)
4
+ Dir["#{dir}/unit/**/*_spec.rb"].each do |file|
5
+ require file
6
+ end
7
+ end
8
+ end
9
+
10
+ UnitSuite.new.run
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: screw-unit-server
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Takita
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-05-08 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: The Screw Unit server conveniently serves your Screw Unit specs and implementations javascript files and css stylesheets. The Screw Unit core is located at http://github.com/nkallen/screw-unit/tree.
17
+ email: brian.takita@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.markdown
24
+ - CHANGES
25
+ files:
26
+ - Rakefile
27
+ - CHANGES
28
+ - README.markdown
29
+ - init.rb
30
+ - lib/screw_unit/resources/spec.rb
31
+ - lib/screw_unit/resources.rb
32
+ - lib/screw_unit.rb
33
+ - core/spec
34
+ - core/spec/matchers_spec.js
35
+ - core/spec/spec_helper.js
36
+ - core/spec/suite.html
37
+ - core/spec/print_spec.js
38
+ - core/spec/behaviors_spec.js
39
+ - core/lib
40
+ - core/lib/jquery-1.2.3.js
41
+ - core/lib/screw.assets.js
42
+ - core/lib/jquery.print.js
43
+ - core/lib/screw.css
44
+ - core/lib/screw.matchers.js
45
+ - core/lib/screw.server.js
46
+ - core/lib/jquery.fn.js
47
+ - core/lib/screw.builder.js
48
+ - core/lib/screw.behaviors.js
49
+ - core/lib/screw.events.js
50
+ - core/example
51
+ - core/example/spec
52
+ - core/example/spec/spec_helper.js
53
+ - core/example/spec/suite.html
54
+ - core/example/spec/matchers
55
+ - core/example/spec/matchers/have.js
56
+ - core/example/spec/models
57
+ - core/example/spec/models/cat_spec.js
58
+ - core/example/spec/models/man_spec.js
59
+ - core/example/models
60
+ - core/example/models/cat.js
61
+ - core/example/models/man.js
62
+ - core/EXAMPLE.html
63
+ - core/LICENSE
64
+ - core/TODO
65
+ - core/README.markdown
66
+ - bin/screw_unit_server
67
+ - bin/screw_unit
68
+ - vendor/js-test-core
69
+ - vendor/js-test-core/spec
70
+ - vendor/js-test-core/spec/spec_suite.rb
71
+ - vendor/js-test-core/spec/example_specs
72
+ - vendor/js-test-core/spec/example_specs/failing_spec.js
73
+ - vendor/js-test-core/spec/example_specs/foo
74
+ - vendor/js-test-core/spec/example_specs/foo/failing_spec.js
75
+ - vendor/js-test-core/spec/example_specs/foo/passing_spec.js
76
+ - vendor/js-test-core/spec/unit
77
+ - vendor/js-test-core/spec/unit/thin
78
+ - vendor/js-test-core/spec/unit/thin/js_test_core_connection_spec.rb
79
+ - vendor/js-test-core/spec/unit/js_test_core
80
+ - vendor/js-test-core/spec/unit/js_test_core/resources
81
+ - vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb
82
+ - vendor/js-test-core/spec/unit/js_test_core/resources/suite_spec.rb
83
+ - vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb
84
+ - vendor/js-test-core/spec/unit/js_test_core/resources/suite_finish_spec.rb
85
+ - vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
86
+ - vendor/js-test-core/spec/unit/js_test_core/resources/runners
87
+ - vendor/js-test-core/spec/unit/js_test_core/resources/runners/firefox_runner_spec.rb
88
+ - vendor/js-test-core/spec/unit/js_test_core/resources/file_not_found_spec.rb
89
+ - vendor/js-test-core/spec/unit/js_test_core/resources/runner_spec.rb
90
+ - vendor/js-test-core/spec/unit/js_test_core/resources/specs
91
+ - vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_dir_spec.rb
92
+ - vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb
93
+ - vendor/js-test-core/spec/unit/js_test_core/server_spec.rb
94
+ - vendor/js-test-core/spec/unit/js_test_core/client_spec.rb
95
+ - vendor/js-test-core/spec/unit/js_test_core/rails_server_spec.rb
96
+ - vendor/js-test-core/spec/unit/unit_spec_helper.rb
97
+ - vendor/js-test-core/spec/specs
98
+ - vendor/js-test-core/spec/specs/failing_spec.js
99
+ - vendor/js-test-core/spec/example_core
100
+ - vendor/js-test-core/spec/example_core/JsTestCore.js
101
+ - vendor/js-test-core/spec/example_core/JsTestCore.css
102
+ - vendor/js-test-core/spec/unit_suite.rb
103
+ - vendor/js-test-core/spec/example_public
104
+ - vendor/js-test-core/spec/example_public/javascripts
105
+ - vendor/js-test-core/spec/example_public/javascripts/foo.js
106
+ - vendor/js-test-core/spec/example_public/robots.txt
107
+ - vendor/js-test-core/spec/example_public/stylesheets
108
+ - vendor/js-test-core/spec/example_public/stylesheets/example.css
109
+ - vendor/js-test-core/spec/example_public/favicon.ico
110
+ - vendor/js-test-core/lib
111
+ - vendor/js-test-core/lib/js_test_core
112
+ - vendor/js-test-core/lib/js_test_core/rack.rb
113
+ - vendor/js-test-core/lib/js_test_core/thin
114
+ - vendor/js-test-core/lib/js_test_core/thin/backends
115
+ - vendor/js-test-core/lib/js_test_core/thin/backends/js_test_core_server.rb
116
+ - vendor/js-test-core/lib/js_test_core/thin/js_test_core_connection.rb
117
+ - vendor/js-test-core/lib/js_test_core/rack
118
+ - vendor/js-test-core/lib/js_test_core/rack/commonlogger.rb
119
+ - vendor/js-test-core/lib/js_test_core/selenium
120
+ - vendor/js-test-core/lib/js_test_core/selenium/selenium_driver.rb
121
+ - vendor/js-test-core/lib/js_test_core/selenium.rb
122
+ - vendor/js-test-core/lib/js_test_core/resources
123
+ - vendor/js-test-core/lib/js_test_core/resources/dir.rb
124
+ - vendor/js-test-core/lib/js_test_core/resources/runners
125
+ - vendor/js-test-core/lib/js_test_core/resources/runners/firefox_runner.rb
126
+ - vendor/js-test-core/lib/js_test_core/resources/suite_finish.rb
127
+ - vendor/js-test-core/lib/js_test_core/resources/web_root.rb
128
+ - vendor/js-test-core/lib/js_test_core/resources/file.rb
129
+ - vendor/js-test-core/lib/js_test_core/resources/suite.rb
130
+ - vendor/js-test-core/lib/js_test_core/resources/runners.rb
131
+ - vendor/js-test-core/lib/js_test_core/resources/specs
132
+ - vendor/js-test-core/lib/js_test_core/resources/specs/spec_file.rb
133
+ - vendor/js-test-core/lib/js_test_core/resources/specs/spec_dir.rb
134
+ - vendor/js-test-core/lib/js_test_core/resources/file_not_found.rb
135
+ - vendor/js-test-core/lib/js_test_core/rails_server.rb
136
+ - vendor/js-test-core/lib/js_test_core/resources.rb
137
+ - vendor/js-test-core/lib/js_test_core/thin.rb
138
+ - vendor/js-test-core/lib/js_test_core/server.rb
139
+ - vendor/js-test-core/lib/js_test_core/client.rb
140
+ - vendor/js-test-core/lib/js_test_core.rb
141
+ - vendor/js-test-core/Rakefile
142
+ - vendor/js-test-core/CHANGES
143
+ - vendor/js-test-core/README
144
+ - spec/spec_suite.rb
145
+ - spec/example_specs
146
+ - spec/functional
147
+ - spec/unit
148
+ - spec/functional_suite.rb
149
+ - spec/unit_suite.rb
150
+ - spec/example_public
151
+ has_rdoc: true
152
+ homepage: http://github.com/btakita/screw-unit-server
153
+ post_install_message:
154
+ rdoc_options:
155
+ - --main
156
+ - README.markdown
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: "0"
164
+ version:
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: "0"
170
+ version:
171
+ requirements: []
172
+
173
+ rubyforge_project:
174
+ rubygems_version: 1.1.0
175
+ signing_key:
176
+ specification_version: 2
177
+ summary: The ScrewUnit client library (http://github.com/nkallen/screw-unit) plus a convenient ruby server.
178
+ test_files:
179
+ - spec/spec_suite.rb
180
+ - spec/functional/functional_spec.rb
181
+ - spec/functional/functional_spec_helper.rb
182
+ - spec/unit/js_test_core/specs/spec_dir_spec.rb
183
+ - spec/unit/js_test_core/specs/spec_file_spec.rb
184
+ - spec/unit/unit_spec_helper.rb
185
+ - spec/functional_suite.rb
186
+ - spec/unit_suite.rb