jasmine 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jasmine/server.rb +14 -6
- data/spec/server_spec.rb +1 -7
- metadata +2 -2
data/lib/jasmine/server.rb
CHANGED
@@ -12,7 +12,17 @@ module Jasmine
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def call(env)
|
15
|
-
|
15
|
+
return not_found if env["PATH_INFO"] != "/"
|
16
|
+
return [200,{ 'Content-Type' => 'text/html' }, ''] if (env['REQUEST_METHOD'] == 'HEAD')
|
17
|
+
run if env['REQUEST_METHOD'] == 'GET'
|
18
|
+
end
|
19
|
+
|
20
|
+
def not_found
|
21
|
+
body = "File not found: #{@path_info}\n"
|
22
|
+
[404, {"Content-Type" => "text/plain",
|
23
|
+
"Content-Length" => body.size.to_s,
|
24
|
+
"X-Cascade" => "pass"},
|
25
|
+
[body]]
|
16
26
|
end
|
17
27
|
|
18
28
|
#noinspection RubyUnusedLocalVariable
|
@@ -59,8 +69,6 @@ module Jasmine
|
|
59
69
|
class FocusedSuite
|
60
70
|
def initialize(config)
|
61
71
|
@config = config
|
62
|
-
# @spec_files_or_proc = spec_files_or_proc || []
|
63
|
-
# @options = options
|
64
72
|
end
|
65
73
|
|
66
74
|
def call(env)
|
@@ -102,10 +110,10 @@ module Jasmine
|
|
102
110
|
|
103
111
|
app = Rack::Cascade.new([
|
104
112
|
Rack::URLMap.new({'/' => Rack::File.new(@config.src_dir)}),
|
105
|
-
Rack::URLMap.new(thin_config)
|
106
|
-
JsAlert.new
|
113
|
+
Rack::URLMap.new(thin_config)
|
114
|
+
# JsAlert.new
|
107
115
|
])
|
108
|
-
|
116
|
+
# Thin::Logging.trace = true
|
109
117
|
@thin = Thin::Server.new('0.0.0.0', @port, app)
|
110
118
|
end
|
111
119
|
|
data/spec/server_spec.rb
CHANGED
@@ -47,7 +47,7 @@ describe Jasmine::Server do
|
|
47
47
|
|
48
48
|
describe "/ page" do
|
49
49
|
it "should load each js file in order" do
|
50
|
-
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx")
|
50
|
+
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'GET')
|
51
51
|
code.should == 200
|
52
52
|
body = read(body)
|
53
53
|
body.should include("\"/src/file1.js")
|
@@ -56,10 +56,4 @@ describe Jasmine::Server do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
it "should display an error using JS for 404's" do
|
60
|
-
code, headers, body = @thin_app.call("PATH_INFO" => "/spec/NonExistantFile.js", "SCRIPT_NAME" => "xxx")
|
61
|
-
code.should == 200 # todo: shouldn't this be 404? will that work with all browsers?
|
62
|
-
headers["Content-Type"].should == "application/javascript"
|
63
|
-
read(body).should == "document.write('<p>Couldn\\'t load /spec/NonExistantFile.js!</p>');"
|
64
|
-
end
|
65
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Agaskar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-
|
13
|
+
date: 2010-02-16 00:00:00 -08:00
|
14
14
|
default_executable: jasmine
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|