screw-unit 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/CHANGES +7 -1
  2. data/core/CHANGES +10 -0
  3. data/core/example/models/man.js +2 -2
  4. data/core/lib/jquery.print.js +2 -2
  5. data/core/lib/screw.behaviors.js +3 -2
  6. data/core/lib/screw.builder.js +15 -15
  7. data/core/lib/screw.css +2 -2
  8. data/core/lib/screw.events.js +3 -2
  9. data/core/lib/screw.matchers.js +53 -11
  10. data/core/spec/behaviors_spec.js +11 -1
  11. data/core/spec/matchers_spec.js +144 -9
  12. data/core/spec/print_spec.js +14 -8
  13. data/lib/screw_unit/resources/spec.rb +66 -3
  14. data/spec/functional/functional_spec_helper.rb +1 -1
  15. data/spec/unit/js_test_core/specs/spec_dir_spec.rb +7 -8
  16. data/spec/unit/js_test_core/specs/spec_file_spec.rb +5 -6
  17. data/spec/unit/unit_spec_helper.rb +1 -3
  18. data/vendor/js-test-core/CHANGES +5 -0
  19. data/vendor/js-test-core/Rakefile +1 -1
  20. data/vendor/js-test-core/lib/js_test_core/client.rb +19 -16
  21. data/vendor/js-test-core/lib/js_test_core/resources.rb +2 -2
  22. data/vendor/js-test-core/lib/js_test_core/resources/file.rb +9 -18
  23. data/vendor/js-test-core/lib/js_test_core/resources/runner.rb +17 -15
  24. data/vendor/js-test-core/lib/js_test_core/resources/{suite.rb → session.rb} +8 -4
  25. data/vendor/js-test-core/lib/js_test_core/resources/{suite_finish.rb → session_finish.rb} +5 -5
  26. data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +6 -3
  27. data/vendor/js-test-core/spec/unit/js_test_core/client_spec.rb +22 -21
  28. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb +0 -38
  29. data/vendor/js-test-core/spec/unit/js_test_core/resources/runners/runner_spec.rb +83 -63
  30. data/vendor/js-test-core/spec/unit/js_test_core/resources/{suite_finish_spec.rb → session_finish_spec.rb} +15 -18
  31. data/vendor/js-test-core/spec/unit/js_test_core/resources/session_spec.rb +82 -0
  32. data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_dir_spec.rb +3 -3
  33. data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +37 -10
  34. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resource.rb +4 -0
  35. metadata +88 -89
  36. data/core/lib/screw.assets.js +0 -36
  37. data/core/lib/screw.server.js +0 -21
  38. data/vendor/js-test-core/spec/unit/js_test_core/resources/suite_spec.rb +0 -86
@@ -1,36 +0,0 @@
1
- (function() {
2
- Screw.Assets = {};
3
- Screw.Assets.use_cache_buster = false; // TODO: NS/CTI - make this configurable from the UI.
4
- var required_paths = [];
5
- var included_stylesheets = {};
6
- var cache_buster = parseInt(new Date().getTime()/(1*1000));
7
-
8
- Screw.Assets.require = function(javascript_path, onload) {
9
- if(!required_paths[javascript_path]) {
10
- var full_path = javascript_path + ".js";
11
- if (Screw.Assets.use_cache_buster) {
12
- full_path += '?' + cache_buster;
13
- }
14
- document.write("<script src='" + full_path + "' type='text/javascript'></script>");
15
- if(onload) {
16
- var scripts = document.getElementsByTagName('script');
17
- scripts[scripts.length-1].onload = onload;
18
- }
19
- required_paths[javascript_path] = true;
20
- }
21
- };
22
-
23
- Screw.Assets.stylesheet = function(stylesheet_path) {
24
- if(!included_stylesheets[stylesheet_path]) {
25
- var full_path = stylesheet_path + ".css";
26
- if(Screw.Assets.use_cache_buster) {
27
- full_path += '?' + cache_buster;
28
- }
29
- document.write("<link rel='stylesheet' type='text/css' href='" + full_path + "' />");
30
- included_stylesheets[stylesheet_path] = true;
31
- }
32
- };
33
-
34
- window.require = Screw.Assets.require;
35
- window.stylesheet = Screw.Assets.stylesheet;
36
- })();
@@ -1,21 +0,0 @@
1
- (function($) {
2
- var ajax = $.ajax;
3
- $(Screw).bind('after', function() {
4
- var error_text = $(".error").map(function(i, element) {
5
- return element.innerHTML;
6
- }).get().join("\n");
7
-
8
- var suite_id;
9
- if(top.runOptions) {
10
- suite_id = top.runOptions.getSessionId();
11
- } else {
12
- suite_id = 'user';
13
- }
14
-
15
- ajax({
16
- type: "POST",
17
- url: '/suites/' + suite_id + '/finish',
18
- data: {"text": error_text}
19
- });
20
- });
21
- })(jQuery);
@@ -1,86 +0,0 @@
1
- require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
2
-
3
- module JsTestCore
4
- module Resources
5
- describe Suite do
6
- describe "GET /suites/:suite_id" do
7
- attr_reader :driver, :suite_id
8
-
9
- context "when there is no Runner with the :suite_id" do
10
- it "responds with a 404" do
11
- suite_id = "invalid_suite_id"
12
- Runner.find(suite_id).should be_nil
13
-
14
- mock(connection).send_head(404)
15
- mock(connection).send_body("")
16
-
17
- connection.receive_data("GET /suites/#{suite_id} HTTP/1.1\r\nHost: _\r\n\r\n")
18
- end
19
- end
20
-
21
- context "when there is a Runner with the :suite_id" do
22
- attr_reader :suite_runner
23
- before do
24
- @driver = "Selenium Driver"
25
- @suite_id = "DEADBEEF"
26
- stub(Selenium::SeleniumDriver).new('localhost', 4444, '*firefox', 'http://0.0.0.0:8080') do
27
- driver
28
- end
29
-
30
- stub(driver).start
31
- stub(driver).session_id {suite_id}
32
- connection_that_starts_firefox = create_connection
33
- stub(connection_that_starts_firefox).send_head
34
- stub(connection_that_starts_firefox).send_body
35
- connection_that_starts_firefox.receive_data("POST /runners/firefox HTTP/1.1\r\nHost: _\r\nContent-Length: 0\r\n\r\n")
36
- @suite_runner = Runner.find(suite_id)
37
- suite_runner.should be_running
38
- end
39
-
40
- context "when a Runner with the :suite_id is running" do
41
- it "responds with a 200 and status=running" do
42
- mock(connection).send_head
43
- mock(connection).send_body("status=#{Resources::Suite::RUNNING}")
44
-
45
- connection.receive_data("GET /suites/#{suite_id} HTTP/1.1\r\nHost: _\r\n\r\n")
46
- end
47
- end
48
-
49
- context "when a Runner with the :suite_id has completed" do
50
- context "when the suite has a status of 'success'" do
51
- before do
52
- stub(driver).stop
53
- suite_runner.finalize("")
54
- suite_runner.should be_successful
55
- end
56
-
57
- it "responds with a 200 and status=success" do
58
- mock(connection).send_head
59
- mock(connection).send_body("status=#{Resources::Suite::SUCCESSFUL_COMPLETION}")
60
-
61
- connection.receive_data("GET /suites/#{suite_id} HTTP/1.1\r\nHost: _\r\n\r\n")
62
- end
63
- end
64
-
65
- context "when the suite has a status of 'failure'" do
66
- attr_reader :reason
67
- before do
68
- stub(driver).stop
69
- @reason = "Failure stuff"
70
- suite_runner.finalize(reason)
71
- suite_runner.should be_failed
72
- end
73
-
74
- it "responds with a 200 and status=failure and reason" do
75
- mock(connection).send_head
76
- mock(connection).send_body("status=#{Resources::Suite::FAILURE_COMPLETION}&reason=#{reason}")
77
-
78
- connection.receive_data("GET /suites/#{suite_id} HTTP/1.1\r\nHost: _\r\n\r\n")
79
- end
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end
86
- end