honkster-screw-unit-server 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/CHANGES +48 -0
  2. data/README.markdown +359 -0
  3. data/Rakefile +43 -0
  4. data/VERSION.yml +5 -0
  5. data/bin/screw_unit +6 -0
  6. data/bin/screw_unit_server +14 -0
  7. data/core/CHANGES +10 -0
  8. data/core/EXAMPLE.html +68 -0
  9. data/core/LICENSE +22 -0
  10. data/core/README.markdown +307 -0
  11. data/core/example/models/cat.js +5 -0
  12. data/core/example/models/man.js +17 -0
  13. data/core/example/spec/matchers/have.js +8 -0
  14. data/core/example/spec/models/cat_spec.js +31 -0
  15. data/core/example/spec/models/man_spec.js +34 -0
  16. data/core/example/spec/spec_helper.js +5 -0
  17. data/core/example/spec/suite.html +25 -0
  18. data/core/lib/jquery-1.3.2.js +4376 -0
  19. data/core/lib/jquery.fn.js +30 -0
  20. data/core/lib/jquery.print.js +109 -0
  21. data/core/lib/screw.behaviors.js +93 -0
  22. data/core/lib/screw.builder.js +95 -0
  23. data/core/lib/screw.css +90 -0
  24. data/core/lib/screw.events.js +45 -0
  25. data/core/lib/screw.matchers.js +244 -0
  26. data/core/spec/behaviors_spec.js +166 -0
  27. data/core/spec/matchers_spec.js +372 -0
  28. data/core/spec/print_spec.js +158 -0
  29. data/core/spec/spec_helper.js +0 -0
  30. data/core/spec/suite.html +19 -0
  31. data/core/spec/with_screw_context_spec.js +9 -0
  32. data/init.rb +0 -0
  33. data/lib/screw_unit.rb +21 -0
  34. data/spec/functional/functional_spec.rb +25 -0
  35. data/spec/functional/functional_spec_helper.rb +42 -0
  36. data/spec/functional/functional_spec_server_starter.rb +68 -0
  37. data/spec/functional_suite.rb +10 -0
  38. data/spec/spec_suite.rb +2 -0
  39. data/standalone.ru +3 -0
  40. data/vendor/js-test-core/CHANGES +31 -0
  41. data/vendor/js-test-core/README +6 -0
  42. data/vendor/js-test-core/Rakefile +73 -0
  43. data/vendor/js-test-core/bin/js-test-client +0 -0
  44. data/vendor/js-test-core/bin/js-test-server +6 -0
  45. data/vendor/js-test-core/lib/js_test_core.rb +38 -0
  46. data/vendor/js-test-core/lib/js_test_core/app.rb +11 -0
  47. data/vendor/js-test-core/lib/js_test_core/client.rb +139 -0
  48. data/vendor/js-test-core/lib/js_test_core/configuration.rb +65 -0
  49. data/vendor/js-test-core/lib/js_test_core/representations.rb +13 -0
  50. data/vendor/js-test-core/lib/js_test_core/representations/dir.html.rb +25 -0
  51. data/vendor/js-test-core/lib/js_test_core/representations/frameworks.rb +3 -0
  52. data/vendor/js-test-core/lib/js_test_core/representations/not_found.html.rb +16 -0
  53. data/vendor/js-test-core/lib/js_test_core/representations/page.html.rb +41 -0
  54. data/vendor/js-test-core/lib/js_test_core/representations/suite.html.rb +57 -0
  55. data/vendor/js-test-core/lib/js_test_core/representations/suites.rb +3 -0
  56. data/vendor/js-test-core/lib/js_test_core/representations/suites/screw_unit.html.rb +81 -0
  57. data/vendor/js-test-core/lib/js_test_core/resources.rb +15 -0
  58. data/vendor/js-test-core/lib/js_test_core/resources/core_file.rb +19 -0
  59. data/vendor/js-test-core/lib/js_test_core/resources/file.rb +62 -0
  60. data/vendor/js-test-core/lib/js_test_core/resources/implementations_deprecation.rb +12 -0
  61. data/vendor/js-test-core/lib/js_test_core/resources/not_found.rb +28 -0
  62. data/vendor/js-test-core/lib/js_test_core/resources/resource.rb +16 -0
  63. data/vendor/js-test-core/lib/js_test_core/resources/spec_file.rb +51 -0
  64. data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +15 -0
  65. data/vendor/js-test-core/lib/js_test_core/server.rb +84 -0
  66. data/vendor/js-test-core/public/js_test_server.js +541 -0
  67. data/vendor/js-test-core/spec/example_framework/JsTestCore.css +0 -0
  68. data/vendor/js-test-core/spec/example_framework/JsTestCore.js +0 -0
  69. data/vendor/js-test-core/spec/example_framework/subdir/SubDirFile.js +0 -0
  70. data/vendor/js-test-core/spec/example_root/favicon.ico +0 -0
  71. data/vendor/js-test-core/spec/example_root/javascripts/foo.js +3 -0
  72. data/vendor/js-test-core/spec/example_root/javascripts/large_file.js +59 -0
  73. data/vendor/js-test-core/spec/example_root/javascripts/subdir/bar.js +1 -0
  74. data/vendor/js-test-core/spec/example_root/robots.txt +0 -0
  75. data/vendor/js-test-core/spec/example_root/stylesheets/example.css +3 -0
  76. data/vendor/js-test-core/spec/example_spec/custom_dir_and_suite/passing_spec.js +8 -0
  77. data/vendor/js-test-core/spec/example_spec/custom_suite.html +8 -0
  78. data/vendor/js-test-core/spec/example_spec/failing_spec.js +7 -0
  79. data/vendor/js-test-core/spec/example_spec/foo/failing_spec.js +8 -0
  80. data/vendor/js-test-core/spec/example_spec/foo/passing_spec.js +8 -0
  81. data/vendor/js-test-core/spec/example_spec/passing_spec.js +8 -0
  82. data/vendor/js-test-core/spec/functional/functional_spec.rb +25 -0
  83. data/vendor/js-test-core/spec/functional/functional_spec_helper.rb +42 -0
  84. data/vendor/js-test-core/spec/functional/functional_spec_server_starter.rb +77 -0
  85. data/vendor/js-test-core/spec/functional_suite.rb +10 -0
  86. data/vendor/js-test-core/spec/spec_helpers/be_http.rb +32 -0
  87. data/vendor/js-test-core/spec/spec_helpers/example_group.rb +36 -0
  88. data/vendor/js-test-core/spec/spec_helpers/fake_selenium_driver.rb +16 -0
  89. data/vendor/js-test-core/spec/spec_helpers/show_test_exceptions.rb +22 -0
  90. data/vendor/js-test-core/spec/spec_suite.rb +3 -0
  91. data/vendor/js-test-core/spec/specs/failing_spec.js +0 -0
  92. data/vendor/js-test-core/spec/unit/js_test_core/client_spec.rb +196 -0
  93. data/vendor/js-test-core/spec/unit/js_test_core/configuration_spec.rb +50 -0
  94. data/vendor/js-test-core/spec/unit/js_test_core/resources/core_file_spec.rb +60 -0
  95. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb +81 -0
  96. data/vendor/js-test-core/spec/unit/js_test_core/resources/implementations_deprecation_spec.rb +18 -0
  97. data/vendor/js-test-core/spec/unit/js_test_core/resources/not_found_spec.rb +51 -0
  98. data/vendor/js-test-core/spec/unit/js_test_core/resources/spec_file_spec.rb +149 -0
  99. data/vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb +28 -0
  100. data/vendor/js-test-core/spec/unit/js_test_core/server_spec.rb +66 -0
  101. data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +30 -0
  102. data/vendor/js-test-core/spec/unit_suite.rb +10 -0
  103. data/vendor/js-test-core/standalone.ru +1 -0
  104. data/vendor/js-test-core/vendor/lucky-luciano/README.markdown +77 -0
  105. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano.rb +5 -0
  106. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/resource.rb +142 -0
  107. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/resource/path.rb +24 -0
  108. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec.rb +4 -0
  109. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec/be_http.rb +32 -0
  110. data/vendor/js-test-core/vendor/lucky-luciano/spec/lucky_luciano/resource_spec.rb +276 -0
  111. data/vendor/js-test-core/vendor/lucky-luciano/spec/spec_helper.rb +48 -0
  112. data/vendor/js-test-core/vendor/lucky-luciano/spec/spec_suite.rb +4 -0
  113. data/vendor/js-test-core/vendor/lucky-luciano/syntax_ideas.txt +34 -0
  114. metadata +201 -0
@@ -0,0 +1,158 @@
1
+ Screw.Unit(function() {
2
+ describe("Print", function() {
3
+ describe('when given undefined', function() {
4
+ it("returns 'undefined'", function() {
5
+ expect($.print(undefined)).to(equal, 'undefined');
6
+ });
7
+ });
8
+
9
+ describe('when given null', function() {
10
+ it("returns 'null'", function() {
11
+ expect($.print(null)).to(equal, 'null');
12
+ });
13
+ });
14
+
15
+ describe('when given a number', function() {
16
+ it("returns the string representation of the number", function() {
17
+ expect($.print(1)).to(equal, '1');
18
+ expect($.print(1.01)).to(equal, '1.01');
19
+ expect($.print(-1)).to(equal, '-1');
20
+ });
21
+ });
22
+
23
+ describe('when given a boolean', function() {
24
+ it("returns the string representation of the boolean", function() {
25
+ expect($.print(true)).to(equal, 'true');
26
+ expect($.print(false)).to(equal, 'false');
27
+ });
28
+ });
29
+
30
+ describe('when given a string', function() {
31
+ it("returns the string, quoted", function() {
32
+ expect($.print('asdf')).to(equal, '"asdf"');
33
+ });
34
+
35
+ describe('when the string is longer than the [max_string] option', function() {
36
+ it("returns the string, truncated", function() {
37
+ expect($.print('asdf', { max_string: 3 })).to(equal, '"asd..."');
38
+ });
39
+ });
40
+
41
+ describe('when the strings has quotes or escaped characters', function() {
42
+ it("returns the string, with quotes and escaped characters escaped", function() {
43
+ expect($.print('as"df')).to(equal, '"as\\"df"');
44
+ expect($.print('as\tdf')).to(equal, '"as\\tdf"');
45
+ });
46
+ });
47
+ });
48
+
49
+ describe('when given a function', function() {
50
+ it("returns the function's signature", function() {
51
+ expect($.print(function() {})).to(match, /function\s*\(\)/);
52
+ expect($.print(function foo() {})).to(match, /function\s*foo\(\)/);
53
+ expect($.print(function foo(bar) {})).to(match, /function\s*foo\(bar\)/);
54
+ });
55
+ });
56
+
57
+ describe('when given a RegExp', function() {
58
+ it('should print the regexp', function() {
59
+ expect($.print(/abc/i)).to(equal, '/abc/i');
60
+ });
61
+ });
62
+
63
+ describe('when given NaN', function() {
64
+ it('should print the string "NaN"', function() {
65
+ expect($.print(NaN)).to(equal, 'NaN');
66
+ });
67
+ });
68
+
69
+ describe('when given 0', function() {
70
+ it('should print the string "0"', function() {
71
+ expect($.print(0)).to(equal, '0');
72
+ });
73
+ });
74
+
75
+ describe('when given an element', function() {
76
+ it("returns the string representation of the element", function() {
77
+ expect($.print($('<div></div>').get(0))).to(equal, '<div>');
78
+ expect($.print($('<div foo="bar"></div>').get(0))).to(equal, '<div>');
79
+ expect($.print($('<div class="foo" id="bar"></div>').get(0))).to(equal, '<div class="foo" id="bar">');
80
+ });
81
+
82
+ describe('when the element is an img', function() {
83
+ it('prints out the img src attribute', function() {
84
+ expect($.print($('<img src="test.png"/>'))).to(match, /<img src=".+?test.png">/);
85
+ })
86
+ });
87
+ });
88
+
89
+ describe('when given an array', function() {
90
+ it("returns the printed elements, comma separated, encircled by square brackets", function() {
91
+ expect($.print([])).to(equal, '[]');
92
+ expect($.print([1])).to(equal, '[ 1 ]');
93
+ expect($.print([1, 2, 3])).to(equal, '[ 1, 2, 3 ]');
94
+ });
95
+
96
+ describe('when the array is longer than the [max_array] option', function() {
97
+ it("returns the printed array, truncated", function() {
98
+ expect($.print([1, 2, 3, 4], { max_array: 2 })).to(equal, '[ 1, 2, 2 more... ]');
99
+ });
100
+ });
101
+
102
+ describe('when the array has arrays as its elements', function() {
103
+ it("returns the recursively printed array", function() {
104
+ expect($.print([[]])).to(equal, '[ [] ]');
105
+ expect($.print([ [1, 2, 3], 4 ])).to(equal, '[ [ 1, 2, 3 ], 4 ]');
106
+ });
107
+ });
108
+
109
+ describe('when the array has objects as its elements', function() {
110
+ it("returns recursively printed array", function() {
111
+ expect($.print([{}])).to(equal, '[ {} ]');
112
+ expect($.print([ { foo: 'bar' }, 'baz' ])).to(equal, '[ { foo: "bar" }, "baz" ]');
113
+ });
114
+ });
115
+ });
116
+
117
+ describe('when given arguments', function() {
118
+ it("returns the printed array of elements ", function() {
119
+ var args = null;
120
+ (function(){ args = arguments })(1,2,3);
121
+ expect($.print(args)).to(equal, '[ 1, 2, 3 ]');
122
+ });
123
+ });
124
+
125
+ describe('when given a jQuery', function() {
126
+ it("returns the printed array of elements engirthed in '$()'", function() {
127
+ expect($.print($('<div></div>'))).to(equal, '$([ <div> ])');
128
+ });
129
+ });
130
+
131
+ describe('when given a NodeList', function() {
132
+ it("returns the printed array of elements in the list", function() {
133
+ expect($.print(document.getElementsByTagName('body'))).to(equal, '[ <body> ]');
134
+ });
135
+ });
136
+
137
+ describe('when given an object', function() {
138
+ it("returns the keys and values of the object, enraptured with curly braces", function() {
139
+ expect($.print({})).to(equal, '{}');
140
+ expect($.print({ foo: 1, bar: 2 })).to(equal, '{ foo: 1, bar: 2 }');
141
+ });
142
+
143
+ describe('when the values of the object are non-primitive', function() {
144
+ it("recursively prints the keys and values", function() {
145
+ expect($.print({ foo: [1, 2] })).to(equal, '{ foo: [ 1, 2 ] }');
146
+ });
147
+
148
+ describe('when the object has circular references', function() {
149
+ it("returns elipses for circularities", function() {
150
+ var circular = {};
151
+ circular[0] = circular;
152
+ expect($.print(circular)).to(equal, '{ 0: ... }');
153
+ });
154
+ });
155
+ });
156
+ });
157
+ });
158
+ });
File without changes
@@ -0,0 +1,19 @@
1
+ <html>
2
+ <head>
3
+ <script src="../lib/jquery-1.3.2.js"></script>
4
+ <script src="../lib/jquery.fn.js"></script>
5
+ <script src="../lib/jquery.print.js"></script>
6
+ <script src="../lib/screw.builder.js"></script>
7
+ <script src="../lib/screw.matchers.js"></script>
8
+ <script src="../lib/screw.events.js"></script>
9
+ <script src="../lib/screw.behaviors.js"></script>
10
+ <script src="spec_helper.js"></script>
11
+ <script src="behaviors_spec.js"></script>
12
+ <script src="matchers_spec.js"></script>
13
+ <script src="print_spec.js"></script>
14
+ <script src="with_screw_context_spec.js"></script>
15
+
16
+ <link rel="stylesheet" href="../lib/screw.css">
17
+ </head>
18
+ <body></body>
19
+ </html>
@@ -0,0 +1,9 @@
1
+ Screw.Unit(function(screw) { with(screw) {
2
+ describe("Screw.Unit", function() {
3
+ describe("when the passed-in function has an arity of 1", function() {
4
+ it("passes the Screw.Unit context into the function", function() {
5
+ expect(true).to(equal, true);
6
+ });
7
+ });
8
+ });
9
+ }});
data/init.rb ADDED
File without changes
@@ -0,0 +1,21 @@
1
+ require "rubygems"
2
+
3
+ dir = File.dirname(__FILE__)
4
+ $:.unshift(File.expand_path("#{dir}/../vendor/js-test-core/lib"))
5
+ require "js_test_core"
6
+
7
+ JsTestCore::Server::DEFAULTS[:framework_path] = File.expand_path("#{dir}/../core/lib")
8
+ JsTestCore::Server::DEFAULTS[:framework_name] = "screw-unit"
9
+ module ScrewUnit
10
+ include JsTestCore
11
+
12
+ class << self
13
+ def method_missing(method_name, *args, &block)
14
+ if JsTestCore::Configuration.instance.respond_to?(method_name)
15
+ JsTestCore::Configuration.instance.send(method_name, *args, &block)
16
+ else
17
+ super
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/functional_spec_helper")
2
+
3
+ describe ScrewUnit do
4
+ attr_reader :stdout, :request
5
+ before do
6
+ @stdout = StringIO.new
7
+ ScrewUnit::Client.const_set(:STDOUT, stdout)
8
+ @request = "http request"
9
+ end
10
+
11
+ after do
12
+ ScrewUnit::Client.__send__(:remove_const, :STDOUT)
13
+ end
14
+
15
+ it "runs a full passing Suite" do
16
+ ScrewUnit::Client.run(:spec_url => "#{root_url}/specs/foo/passing_spec")
17
+ stdout.string.strip.should == "Success"
18
+ end
19
+
20
+ it "runs a full failing Suite" do
21
+ ScrewUnit::Client.run(:spec_url => "#{root_url}/specs/foo/failing_spec")
22
+ stdout.string.strip.should include("Failed")
23
+ stdout.string.strip.should include("A failing spec in foo fails: expected true to equal false")
24
+ end
25
+ end
@@ -0,0 +1,42 @@
1
+ require "rubygems"
2
+ require "spec"
3
+ require "spec/autorun"
4
+ require "selenium_rc"
5
+ require "thin"
6
+ dir = File.dirname(__FILE__)
7
+ LIBRARY_ROOT_DIR = File.expand_path("#{dir}/../..")
8
+ require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/be_http"
9
+ require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/show_test_exceptions"
10
+ require "#{dir}/functional_spec_server_starter"
11
+ ARGV.push("-b")
12
+
13
+ Spec::Runner.configure do |config|
14
+ config.mock_with :rr
15
+ end
16
+
17
+ Sinatra::Application.use ShowTestExceptions
18
+ Sinatra::Application.set :raise_errors, true
19
+
20
+ Sinatra::Application.use(ScrewUnit::App)
21
+
22
+
23
+ class Spec::ExampleGroup
24
+ include WaitFor
25
+ attr_reader :spec_root_path, :public_path
26
+
27
+ before(:all) do
28
+ @spec_root_path = FunctionalSpecServerStarter.spec_root_path
29
+ @public_path = FunctionalSpecServerStarter.public_path
30
+ unless SeleniumRC::Server.service_is_running?
31
+ Thread.start do
32
+ SeleniumRC::Server.boot
33
+ end
34
+ end
35
+ FunctionalSpecServerStarter.call
36
+ TCPSocket.wait_for_service :host => "0.0.0.0", :port => "4444"
37
+ end
38
+
39
+ def root_url
40
+ "http://localhost:8080"
41
+ end
42
+ end
@@ -0,0 +1,68 @@
1
+ require "rubygems"
2
+ require "timeout"
3
+ require "lsof"
4
+ dir = File.dirname(__FILE__)
5
+ $LOAD_PATH.unshift "#{dir}/../../lib"
6
+ require "screw_unit"
7
+ require "nokogiri"
8
+
9
+ module WaitFor
10
+ extend self
11
+ def wait_for(time=5)
12
+ Timeout.timeout(time) do
13
+ loop do
14
+ value = yield
15
+ return value if value
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ class FunctionalSpecServerStarter
22
+ class << self
23
+ include WaitFor
24
+ def call(threaded=true)
25
+ return if $screw_unit_server_started
26
+
27
+ Lsof.kill(8080)
28
+ wait_for do
29
+ !Lsof.running?(8080)
30
+ end
31
+
32
+ dir = File.dirname(__FILE__)
33
+ Dir.chdir("#{dir}/../../") do
34
+ Thread.start do
35
+ start_thin_server
36
+ end
37
+ end
38
+
39
+ wait_for do
40
+ Lsof.running?(8080)
41
+ end
42
+ $screw_unit_server_started = true
43
+ end
44
+
45
+ def start_thin_server
46
+ at_exit do
47
+ Lsof.kill(8080)
48
+ end
49
+ system("bin/screw_unit_server --spec-path=#{spec_root_path} --root-path=#{public_path}")
50
+ end
51
+
52
+ def spec_root_path
53
+ File.expand_path("#{dir}/../example_specs")
54
+ end
55
+
56
+ def public_path
57
+ File.expand_path("#{dir}/../example_public")
58
+ end
59
+
60
+ def dir
61
+ dir = File.dirname(__FILE__)
62
+ end
63
+ end
64
+ end
65
+
66
+ if $0 == __FILE__
67
+ FunctionalSpecServerStarter.call(false)
68
+ end
@@ -0,0 +1,10 @@
1
+ class FunctionalSuite
2
+ def run
3
+ dir = File.dirname(__FILE__)
4
+ Dir["#{dir}/functional/**/*_spec.rb"].each do |file|
5
+ require file
6
+ end
7
+ end
8
+ end
9
+
10
+ FunctionalSuite.new.run
@@ -0,0 +1,2 @@
1
+ dir = File.dirname(__FILE__)
2
+ raise "Failure" unless system(%Q|ruby #{dir}/functional_suite.rb|)
@@ -0,0 +1,3 @@
1
+ dir = File.dirname(__FILE__)
2
+ require "#{dir}/lib/screw_unit"
3
+ ScrewUnit::Server.standalone_rackup(self, ENV["SCREW_UNIT_SPEC_ROOT"], ENV["SCREW_UNIT_PUBLIC"])
@@ -0,0 +1,31 @@
1
+ - Added JsTestCore::Representations::Spec.project_js_files and .project_css_files
2
+ - Updated to erector 0.6.7, which fixes a bug related to including modules into Representations.
3
+ - Allow test suite to clear all cookies
4
+ - No longer using the /implementanions directory. Replace all cases of /implementations with /javascripts.
5
+ - Added support for custom suite files
6
+ - Added dependency on Erector
7
+ - Better error messages
8
+ - Changed dependency from Selenium to selenium-client
9
+ - Renamed Resources::Runner to Resources::SeleniumSession
10
+ - Changed /runners to /selenium_sessions
11
+
12
+ 0.2.0
13
+ - Renamed Suite to Session to follow Selenium conventions
14
+ - Renamed SuiteFinish to SessionFinish to follow Selenium conventions
15
+ - Added /session, which uses the session_id cookie to derive the current session.
16
+ - Added /session/finished to be used to simplify client/server interactions.
17
+ - Remove File caching because it doesn't cause a noticable performance benefit over a local network and because it sometimes doesn't write over stale files.
18
+ - Client accepts selenium_browser_start_command parameter, which allows the user to parameterize the selenium_browser_start_command
19
+ - Added support for running specs in Internet Explorer via POST /runners/iexplore
20
+ - Resource file download performance improvements via caching and chunked sending
21
+ - Fixed false positive bug when Client connection times out
22
+
23
+ 0.1.1
24
+ - SuiteFinish#post immediately closes the connection
25
+
26
+ 0.1.0
27
+ - Initial Release extracted from JsTestCore.
28
+ - Added JsTestCore::WebRoot.dispatch_specs and .dispatch_strategy
29
+ - Extracted JsTestCore::Resources::Specs::SpecDir
30
+ - Extracted JsTestCore::Resources::Specs::SpecFile
31
+ - No longer depending on Guid. The child libraries are responsible for obtaining the Selenium session_id from the client by using top.runOptions.getSessionId().
@@ -0,0 +1,6 @@
1
+ = JsTestCore
2
+ JsTestCore provides a command line runner and html suite file generation for your favorite Javascript testing framework.
3
+
4
+ == Current supported frameworks
5
+ * Jasmine
6
+ * Screw Unit
@@ -0,0 +1,73 @@
1
+ require "rake"
2
+ require 'rake/gempackagetask'
3
+ require 'rake/contrib/rubyforgepublisher'
4
+ require 'rake/clean'
5
+ require 'rake/testtask'
6
+ require 'rake/rdoctask'
7
+
8
+ desc "Runs the Rspec suite"
9
+ task(:default) do
10
+ run_suite
11
+ end
12
+
13
+ desc "Runs the Rspec suite"
14
+ task(:spec) do
15
+ run_suite
16
+ end
17
+
18
+ desc "Copies the trunk to a tag with the name of the current release"
19
+ task(:tag_release) do
20
+ tag_release
21
+ end
22
+
23
+ def run_suite
24
+ dir = File.dirname(__FILE__)
25
+ system("ruby #{dir}/spec/spec_suite.rb") || raise("Example Suite failed")
26
+ end
27
+
28
+ PKG_NAME = "js_test_core"
29
+ PKG_VERSION = "0.2.0"
30
+ PKG_FILES = FileList[
31
+ '[A-Z]*',
32
+ '*.rb',
33
+ 'lib/**/*.rb',
34
+ 'core/**',
35
+ 'bin/**',
36
+ 'spec/**/*.rb'
37
+ ]
38
+
39
+ spec = Gem::Specification.new do |s|
40
+ s.name = PKG_NAME
41
+ s.version = PKG_VERSION
42
+ s.summary = "The JsTestCore library is the core javascript test server library used by several JS Test server libraries."
43
+ s.test_files = "spec/spec_suite.rb"
44
+ s.description = s.summary
45
+
46
+ s.files = PKG_FILES.to_a
47
+ s.require_path = 'lib'
48
+
49
+ s.has_rdoc = true
50
+ s.extra_rdoc_files = [ "README", "CHANGES" ]
51
+ s.rdoc_options = ["--main", "README", "--inline-source", "--line-numbers"]
52
+
53
+ s.test_files = Dir.glob('spec/*_spec.rb')
54
+ s.require_path = 'lib'
55
+ s.author = "Brian Takita"
56
+ s.email = "brian@pivotallabs.com"
57
+ s.homepage = "http://pivotallabs.com"
58
+ s.rubyforge_project = "pivotalrb"
59
+ s.add_dependency('Selenium')
60
+ s.add_dependency('thin', '=0.8.1')
61
+ s.add_dependency('erector', "0.7.0")
62
+ end
63
+
64
+ Rake::GemPackageTask.new(spec) do |pkg|
65
+ pkg.need_zip = true
66
+ pkg.need_tar = true
67
+ end
68
+
69
+ def tag_release
70
+ dashed_version = PKG_VERSION.gsub('.', '-')
71
+ svn_user = "#{ENV["SVN_USER"]}@" || ""
72
+ `svn cp svn+ssh://#{svn_user}rubyforge.org/var/svn/pivotalrb/js_test_core/trunk svn+ssh://#{svn_user}rubyforge.org/var/svn/pivotalrb/js_test_core/tags/REL-#{dashed_version} -m 'Version #{PKG_VERSION}'`
73
+ end