pivotal-screw-unit 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGES +6 -0
  2. data/Rakefile +4 -1
  3. data/VERSION.yml +2 -2
  4. data/bin/screw_unit_server +14 -4
  5. data/lib/screw_unit/representations/spec.html.rb +1 -1
  6. data/lib/screw_unit/resources/core_file.rb +7 -0
  7. data/lib/screw_unit.rb +12 -8
  8. data/spec/functional/functional_spec_helper.rb +11 -4
  9. data/spec/functional/functional_spec_server_starter.rb +13 -8
  10. data/spec/unit/js_test_core/specs/spec_file_spec.rb +51 -18
  11. data/spec/unit/unit_spec_helper.rb +22 -90
  12. data/vendor/js-test-core/CHANGES +3 -0
  13. data/vendor/js-test-core/lib/js_test_core/app.rb +12 -0
  14. data/vendor/js-test-core/lib/js_test_core/client.rb +5 -5
  15. data/vendor/js-test-core/lib/js_test_core/configuration.rb +35 -0
  16. data/vendor/js-test-core/lib/js_test_core/{selenium → extensions/selenium}/client/driver.rb +0 -0
  17. data/vendor/js-test-core/lib/js_test_core/extensions.rb +1 -1
  18. data/vendor/js-test-core/lib/js_test_core/models/selenium_session.rb +80 -0
  19. data/vendor/js-test-core/lib/js_test_core/models.rb +8 -0
  20. data/vendor/js-test-core/lib/js_test_core/representations/dir.html.rb +24 -0
  21. data/vendor/js-test-core/{vendor/thin-rest/lib/thin_rest/representations/resource_not_found.html.rb → lib/js_test_core/representations/not_found.html.rb} +3 -7
  22. data/vendor/js-test-core/{vendor/thin-rest/lib/thin_rest → lib/js_test_core}/representations/page.html.rb +1 -1
  23. data/vendor/js-test-core/lib/js_test_core/representations/spec.html.rb +1 -1
  24. data/vendor/js-test-core/lib/js_test_core/representations.rb +4 -2
  25. data/vendor/js-test-core/lib/js_test_core/resources/core_file.rb +19 -0
  26. data/vendor/js-test-core/lib/js_test_core/resources/file.rb +38 -18
  27. data/vendor/js-test-core/lib/js_test_core/resources/implementations_deprecation.rb +12 -0
  28. data/vendor/js-test-core/lib/js_test_core/resources/not_found.rb +35 -0
  29. data/vendor/js-test-core/lib/js_test_core/resources/resource.rb +16 -0
  30. data/vendor/js-test-core/lib/js_test_core/resources/selenium_session.rb +104 -0
  31. data/vendor/js-test-core/lib/js_test_core/resources/spec_file.rb +63 -0
  32. data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +5 -60
  33. data/vendor/js-test-core/lib/js_test_core/resources.rb +7 -8
  34. data/vendor/js-test-core/lib/js_test_core.rb +18 -13
  35. data/vendor/js-test-core/{vendor/thin-rest/README → spec/example_core/subdir/SubDirFile.js} +0 -0
  36. data/vendor/js-test-core/spec/example_specs/custom_dir_and_suite/passing_spec.js +1 -1
  37. data/vendor/js-test-core/spec/example_specs/foo/failing_spec.js +1 -1
  38. data/vendor/js-test-core/spec/example_specs/foo/passing_spec.js +1 -1
  39. data/vendor/js-test-core/spec/spec_helpers/be_http.rb +32 -0
  40. data/vendor/js-test-core/spec/spec_helpers/example_group.rb +36 -0
  41. data/vendor/js-test-core/spec/spec_helpers/fake_selenium_driver.rb +27 -0
  42. data/vendor/js-test-core/spec/spec_helpers/show_test_exceptions.rb +22 -0
  43. data/vendor/js-test-core/spec/unit/js_test_core/client_spec.rb +6 -6
  44. data/vendor/js-test-core/spec/unit/js_test_core/configuration_spec.rb +44 -0
  45. data/vendor/js-test-core/spec/unit/js_test_core/models/selenium_session_spec.rb +85 -0
  46. data/vendor/js-test-core/spec/unit/js_test_core/resources/core_file_spec.rb +60 -0
  47. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb +54 -63
  48. data/vendor/js-test-core/spec/unit/js_test_core/resources/implementations_deprecation_spec.rb +18 -0
  49. data/vendor/js-test-core/spec/unit/js_test_core/resources/not_found_spec.rb +51 -0
  50. data/vendor/js-test-core/spec/unit/js_test_core/resources/selenium_session_spec.rb +362 -0
  51. data/vendor/js-test-core/spec/unit/js_test_core/resources/spec_file_spec.rb +120 -0
  52. data/vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb +15 -19
  53. data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +14 -148
  54. data/vendor/js-test-core/vendor/lucky-luciano/README.markdown +7 -0
  55. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/resource.rb +135 -0
  56. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec/be_http.rb +32 -0
  57. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec.rb +4 -0
  58. data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano.rb +4 -0
  59. data/vendor/js-test-core/vendor/lucky-luciano/spec/lucky_luciano/resource_spec.rb +231 -0
  60. data/vendor/js-test-core/vendor/lucky-luciano/spec/spec_helper.rb +48 -0
  61. data/vendor/js-test-core/vendor/{thin-rest → lucky-luciano}/spec/spec_suite.rb +1 -2
  62. metadata +74 -59
  63. data/spec/unit/js_test_core/specs/spec_dir_spec.rb +0 -39
  64. data/vendor/js-test-core/lib/js_test_core/rack/commonlogger.rb +0 -5
  65. data/vendor/js-test-core/lib/js_test_core/rack.rb +0 -2
  66. data/vendor/js-test-core/lib/js_test_core/rails_server.rb +0 -22
  67. data/vendor/js-test-core/lib/js_test_core/resources/dir.rb +0 -67
  68. data/vendor/js-test-core/lib/js_test_core/resources/runner.rb +0 -107
  69. data/vendor/js-test-core/lib/js_test_core/resources/session.rb +0 -44
  70. data/vendor/js-test-core/lib/js_test_core/resources/session_finish.rb +0 -17
  71. data/vendor/js-test-core/lib/js_test_core/resources/specs/spec.rb +0 -32
  72. data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_dir.rb +0 -50
  73. data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_file.rb +0 -21
  74. data/vendor/js-test-core/lib/js_test_core/selenium.rb +0 -2
  75. data/vendor/js-test-core/lib/js_test_core/server.rb +0 -50
  76. data/vendor/js-test-core/lib/js_test_core/thin/backends/js_test_core_server.rb +0 -9
  77. data/vendor/js-test-core/lib/js_test_core/thin/js_test_core_connection.rb +0 -8
  78. data/vendor/js-test-core/lib/js_test_core/thin.rb +0 -3
  79. data/vendor/js-test-core/spec/example_specs/custom_dir_and_suite.html +0 -9
  80. data/vendor/js-test-core/spec/unit/js_test_core/rails_server_spec.rb +0 -45
  81. data/vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb +0 -53
  82. data/vendor/js-test-core/spec/unit/js_test_core/resources/file_not_found_spec.rb +0 -16
  83. data/vendor/js-test-core/spec/unit/js_test_core/resources/runners/runner_spec.rb +0 -303
  84. data/vendor/js-test-core/spec/unit/js_test_core/resources/session_finish_spec.rb +0 -79
  85. data/vendor/js-test-core/spec/unit/js_test_core/resources/session_spec.rb +0 -82
  86. data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_dir_spec.rb +0 -104
  87. data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb +0 -41
  88. data/vendor/js-test-core/spec/unit/js_test_core/server_spec.rb +0 -117
  89. data/vendor/js-test-core/spec/unit/thin/js_test_core_connection_spec.rb +0 -6
  90. data/vendor/js-test-core/vendor/thin-rest/CHANGES +0 -2
  91. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/connection.rb +0 -117
  92. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/extensions/object.rb +0 -21
  93. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/extensions.rb +0 -3
  94. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/representations/internal_error.html.rb +0 -20
  95. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/representations.rb +0 -4
  96. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resources/internal_error.rb +0 -11
  97. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resources/resource.rb +0 -105
  98. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resources/resource_not_found.rb +0 -19
  99. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resources.rb +0 -4
  100. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/routing_error.rb +0 -5
  101. data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest.rb +0 -10
  102. data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/connection_spec.rb +0 -205
  103. data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/resources/resource_not_found_spec.rb +0 -16
  104. data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/resources/resource_spec.rb +0 -135
  105. data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/resources/root_spec.rb +0 -16
  106. data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest_spec_helper.rb +0 -134
@@ -62,7 +62,7 @@ module JsTestCore
62
62
  context "when the Session is not found" do
63
63
  it "raises a SessionNotFound error" do
64
64
  mock_post_to_runner("*firefox")
65
- mock(request).get("/sessions/my_session_id") do
65
+ mock(request).get(Resources::SeleniumSession.path(":session_id", :session_id => "my_session_id")) do
66
66
  stub(session_response = Object.new).code {"404"}
67
67
  session_response
68
68
  end
@@ -98,13 +98,13 @@ module JsTestCore
98
98
 
99
99
  def mock_post_to_runner(selenium_browser_start_command)
100
100
  mock(start_session_response = Object.new).body {"session_id=my_session_id"}
101
- mock(request).post("/runners", "selenium_browser_start_command=#{CGI.escape(selenium_browser_start_command)}&selenium_host=localhost&selenium_port=4444") do
101
+ mock(request).post(Resources::SeleniumSession.path, "selenium_browser_start_command=#{CGI.escape(selenium_browser_start_command)}&selenium_host=localhost&selenium_port=4444") do
102
102
  start_session_response
103
103
  end
104
104
  end
105
105
 
106
106
  def mock_polling_returns(session_statuses=[])
107
- mock(request).get("/sessions/my_session_id") do
107
+ mock(request).get(Resources::SeleniumSession.path(":session_id", :session_id => "my_session_id")) do
108
108
  stub(session_response = Object.new).body {session_statuses.shift}
109
109
  stub(session_response).code {"200"}
110
110
  session_response
@@ -112,15 +112,15 @@ module JsTestCore
112
112
  end
113
113
 
114
114
  def running_status
115
- "status=#{Resources::Session::RUNNING}"
115
+ "status=#{Resources::SeleniumSession::RUNNING}"
116
116
  end
117
117
 
118
118
  def success_status
119
- "status=#{Resources::Session::SUCCESSFUL_COMPLETION}"
119
+ "status=#{Resources::SeleniumSession::SUCCESSFUL_COMPLETION}"
120
120
  end
121
121
 
122
122
  def failure_status(reason)
123
- "status=#{Resources::Session::FAILURE_COMPLETION}&reason=#{reason}"
123
+ "status=#{Resources::SeleniumSession::FAILURE_COMPLETION}&reason=#{reason}"
124
124
  end
125
125
  end
126
126
 
@@ -0,0 +1,44 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../unit_spec_helper")
2
+
3
+ module JsTestCore
4
+ describe Configuration do
5
+ attr_reader :result
6
+
7
+ before do
8
+ @result = ""
9
+ end
10
+
11
+ describe ".spec_root" do
12
+ it "returns the Dir " do
13
+ Configuration.spec_root_path.should == spec_root_path
14
+ end
15
+ end
16
+
17
+ describe ".spec_root_path" do
18
+ it "returns the absolute path of the specs root directory" do
19
+ Configuration.spec_root_path.should == spec_root_path
20
+ end
21
+ end
22
+
23
+ describe ".public_path" do
24
+ it "returns the expanded path of the public path" do
25
+ Configuration.public_path.should == public_path
26
+ end
27
+ end
28
+
29
+ describe ".core_path" do
30
+ it "returns the expanded path to the JsTestCore core directory" do
31
+ Configuration.core_path.should == core_path
32
+ end
33
+ end
34
+
35
+ describe "#root_url" do
36
+ it "returns the url of the site's root" do
37
+ server = Configuration.new
38
+ server.host = "localhost"
39
+ server.port = 9999
40
+ server.root_url.should == "http://localhost:9999"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,85 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
2
+
3
+ module JsTestCore
4
+ module Models
5
+ describe SeleniumSession do
6
+ attr_reader :driver, :session_id, :selenium_session
7
+
8
+ before do
9
+ @driver = FakeSeleniumDriver.new
10
+ @selenium_session = SeleniumSession.new(:spec_url => "http://localhost:8080/specs")
11
+ stub(selenium_session).driver {driver}
12
+ driver.start
13
+ @session_id = driver.session_id
14
+ SeleniumSession.register(selenium_session)
15
+ end
16
+
17
+ describe ".find" do
18
+ context "when passed an id for which there is a corresponding selenium_session" do
19
+ it "returns the selenium_session" do
20
+ SeleniumSession.find(session_id).should == selenium_session
21
+ end
22
+ end
23
+
24
+ context "when passed an id for which there is no corresponding selenium_session" do
25
+ it "returns nil" do
26
+ invalid_id = "666666666666666"
27
+ SeleniumSession.find(invalid_id).should be_nil
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "#running?" do
33
+ context "when the driver#session_started? is true" do
34
+ it "returns true" do
35
+ driver.session_started?.should be_true
36
+ selenium_session.should be_running
37
+ end
38
+ end
39
+
40
+ context "when the driver#session_started? is false" do
41
+ it "returns false" do
42
+ driver.stop
43
+ driver.session_started?.should be_false
44
+ selenium_session.should_not be_running
45
+ end
46
+ end
47
+ end
48
+
49
+ describe "#finalize" do
50
+ attr_reader :selenium_session
51
+
52
+ before do
53
+ mock.proxy(driver).stop
54
+ end
55
+
56
+ it "kills the browser and stores the #run_result" do
57
+ run_result = "The session run result"
58
+ selenium_session.finish(run_result)
59
+ selenium_session.run_result.should == run_result
60
+ end
61
+
62
+ it "sets #run_result" do
63
+ selenium_session.finish("the result")
64
+ selenium_session.run_result.should == "the result"
65
+ end
66
+
67
+ context "when passed an empty string" do
68
+ it "causes #successful? to be true" do
69
+ selenium_session.finish("")
70
+ selenium_session.should be_successful
71
+ selenium_session.should_not be_failed
72
+ end
73
+ end
74
+
75
+ context "when passed a non-empty string" do
76
+ it "causes #successful? to be false" do
77
+ selenium_session.finish("A bunch of error stuff")
78
+ selenium_session.should_not be_successful
79
+ selenium_session.should be_failed
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,60 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
2
+
3
+ module JsTestCore
4
+ module Resources
5
+ describe CoreFile do
6
+ describe "Files" do
7
+ describe "GET /core/JsTestCore.js" do
8
+ it "renders the JsTestCore.js file, which lives in the core framework directory" do
9
+ absolute_path = "#{core_path}/JsTestCore.js"
10
+
11
+ response = get(CoreFile.path("JsTestCore.js"))
12
+ response.should be_http(
13
+ 200,
14
+ {
15
+ "Content-Type" => "text/javascript",
16
+ "Last-Modified" => ::File.mtime(absolute_path).rfc822
17
+ },
18
+ ::File.read(absolute_path)
19
+ )
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "Directories" do
25
+ macro "returns a page with the files in the root core directory" do |relative_path|
26
+ it "returns a page with the files in the root core directory" do
27
+ response = get(CoreFile.path(relative_path))
28
+ response.should be_http(
29
+ 200,
30
+ {},
31
+ ""
32
+ )
33
+ doc = Nokogiri::HTML(response.body)
34
+ links = doc.search("a").map {|script| script["href"]}
35
+ links.should include("/core/JsTestCore.js")
36
+ links.should include("/core/JsTestCore.css")
37
+ links.should include("/core/subdir")
38
+ end
39
+ end
40
+ describe "GET /core" do
41
+ send("returns a page with the files in the root core directory", "")
42
+ end
43
+ describe "GET /core/" do
44
+ send("returns a page with the files in the root core directory", "/")
45
+ end
46
+
47
+ describe "GET /core/subdir" do
48
+ it "returns a page with the files in the directory" do
49
+ response = get(CoreFile.path("subdir"))
50
+ response.should be_http(
51
+ 200,
52
+ {},
53
+ %r(<a href="/core/subdir/SubDirFile.js">SubDirFile.js</a>)
54
+ )
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -3,86 +3,77 @@ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
3
3
  module JsTestCore
4
4
  module Resources
5
5
  describe File do
6
- before do
7
- WebRoot.dispatch_specs
8
- stub_send_data
9
- stub(EventMachine).close_connection
10
- end
11
-
12
- describe "GET" do
6
+ describe "Files" do
13
7
  describe "GET /stylesheets/example.css" do
14
- it "returns a page with a of files in the directory" do
8
+ it "returns the example.css file content as a css file" do
15
9
  path = "#{public_path}/stylesheets/example.css"
16
- mock(connection).send_head(200, 'Content-Type' => "text/css", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
17
- mock(connection).send_data(::File.read(path))
18
-
19
- connection.receive_data("GET /stylesheets/example.css HTTP/1.1\r\nHost: _\r\n\r\n")
10
+ response = get("/stylesheets/example.css")
11
+ response.should be_http(
12
+ 200,
13
+ {
14
+ 'Content-Length' => ::File.size(path).to_s,
15
+ 'Content-Type' => "text/css",
16
+ 'Last-Modified' => ::File.mtime(path).rfc822
17
+ },
18
+ ::File.read(path)
19
+ )
20
20
  end
21
21
  end
22
22
 
23
- describe "GET /implementations/foo.js" do
24
- it "returns a page with a of files in the directory" do
23
+ describe "GET /javascripts/foo.js" do
24
+ it "returns the foo.js file content as a javascript file" do
25
25
  path = "#{public_path}/javascripts/foo.js"
26
- mock(connection).send_head(200, 'Content-Type' => "text/javascript", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
27
- mock(connection).send_data(::File.read(path))
28
-
29
- connection.receive_data("GET /implementations/foo.js HTTP/1.1\r\nHost: _\r\n\r\n")
26
+ response = get("/javascripts/foo.js")
27
+ response.should be_http(
28
+ 200,
29
+ {
30
+ 'Content-Length' => ::File.size(path).to_s,
31
+ 'Content-Type' => "text/javascript",
32
+ 'Last-Modified' => ::File.mtime(path).rfc822
33
+ },
34
+ ::File.read(path)
35
+ )
30
36
  end
31
37
  end
32
38
 
33
39
  describe "GET /javascripts/subdir/bar.js - Subdirectory" do
34
- it "returns a page with a of files in the directory" do
40
+ it "returns the subdir/bar.js file content as a javascript file" do
35
41
  path = "#{public_path}/javascripts/subdir/bar.js"
36
- mock(connection).send_head(200, 'Content-Type' => "text/javascript", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
37
- mock(connection).send_data(::File.read(path))
38
-
39
- connection.receive_data("GET /javascripts/subdir/bar.js HTTP/1.1\r\nHost: _\r\n\r\n")
40
- end
41
- end
42
-
43
- describe "GET /implementations/large_file.js - Large files" do
44
- it "returns a page in 1024 byte chunks" do
45
- chunk_count = 0
46
- path = "#{public_path}/javascripts/large_file.js"
47
- mock(connection).send_head(200, 'Content-Type' => "text/javascript", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
48
- ::File.open(path) do |file|
49
- while !file.eof?
50
- chunk_count += 1
51
- mock(connection).send_data(file.read(1024))
52
- end
53
- end
54
-
55
- chunk_count.should == (::File.size(path) / 1024.0).ceil.to_i
56
- connection.receive_data("GET /javascripts/large_file.js HTTP/1.1\r\nHost: _\r\n\r\n")
42
+ response = get("/javascripts/subdir/bar.js")
43
+ response.should be_http(
44
+ 200,
45
+ {
46
+ 'Content-Length' => ::File.size(path).to_s,
47
+ 'Content-Type' => "text/javascript",
48
+ 'Last-Modified' => ::File.mtime(path).rfc822
49
+ },
50
+ ::File.read(path)
51
+ )
57
52
  end
58
53
  end
59
54
  end
60
55
 
61
-
62
- describe "==" do
63
- attr_reader :file, :absolute_path, :relative_path
64
-
65
- before do
66
- @absolute_path = "#{implementation_root_path}/foo.js"
67
- @relative_path = "/implementations/foo.js"
68
- @file = Resources::File.new(
69
- :connection => connection,
70
- :absolute_path => absolute_path,
71
- :relative_path => relative_path
72
- )
73
- end
74
-
75
- it "returns true when passed a file with the same absolute and relative paths" do
76
- file.should == Resources::File.new(:absolute_path => absolute_path, :relative_path => relative_path)
77
- end
78
-
79
- it "returns false when passed a file with a different absolute or relative path" do
80
- file.should_not == Resources::File.new(:absolute_path => absolute_path, :relative_path => "bogus")
81
- file.should_not == Resources::File.new(:absolute_path => "bogus", :relative_path => relative_path)
56
+ describe "Directories" do
57
+ describe "GET /stylesheets - Top level directory" do
58
+ it "returns a page with a of files in the directory" do
59
+ response = get("/stylesheets")
60
+ response.should be_http(
61
+ 200,
62
+ {},
63
+ %r(<a href="/stylesheets/example.css">example.css</a>)
64
+ )
65
+ end
82
66
  end
83
67
 
84
- it "when passed a Dir, returns false because File is not a Dir" do
85
- file.should_not == Resources::Dir.new(:absolute_path => absolute_path, :relative_path => relative_path)
68
+ describe "GET /javascripts/subdir - Subdirectory" do
69
+ it "returns a page with a of files in the directory" do
70
+ response = get("/javascripts/subdir")
71
+ response.should be_http(
72
+ 200,
73
+ {},
74
+ %r(<a href="/javascripts/subdir/bar.js">bar.js</a>)
75
+ )
76
+ end
86
77
  end
87
78
  end
88
79
  end
@@ -0,0 +1,18 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
2
+
3
+ module JsTestCore
4
+ module Resources
5
+ describe ImplementationsDeprecation do
6
+ describe "GET /implementations/*" do
7
+ it "responds with a 301 to /javascripts/*" do
8
+ response = get(ImplementationsDeprecation.path("/subdir/bar.js"))
9
+ response.should be_http(
10
+ 301,
11
+ {'Location' => File.path("/javascripts/subdir/bar.js")},
12
+ "This page has been moved to #{File.path("/javascripts/subdir/bar.js")}"
13
+ )
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,51 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
2
+
3
+ module JsTestCore
4
+ module Resources
5
+ describe WebRoot do
6
+ describe "GET / - ResourceNotFound" do
7
+ it "returns a 404 error" do
8
+ response = get("/i_dont_exist")
9
+ response.should be_http(
10
+ 404,
11
+ {},
12
+ Regexp.new("File /i_dont_exist not found")
13
+ )
14
+ end
15
+ end
16
+
17
+ describe "PUT / - ResourceNotFound" do
18
+ it "returns a 404 error" do
19
+ response = put("/i_dont_exist")
20
+ response.should be_http(
21
+ 404,
22
+ {},
23
+ Regexp.new("File /i_dont_exist not found")
24
+ )
25
+ end
26
+ end
27
+
28
+ describe "POST / - ResourceNotFound" do
29
+ it "returns a 404 error" do
30
+ response = post("/i_dont_exist")
31
+ response.should be_http(
32
+ 404,
33
+ {},
34
+ Regexp.new("File /i_dont_exist not found")
35
+ )
36
+ end
37
+ end
38
+
39
+ describe "DELETE / - ResourceNotFound" do
40
+ it "returns a 404 error" do
41
+ response = delete("/i_dont_exist")
42
+ response.should be_http(
43
+ 404,
44
+ {},
45
+ Regexp.new("File /i_dont_exist not found")
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end