Fix for 'jasmine:ci' task failure with large numbers of src files

This commit is contained in:
ragaskar
2010-02-16 23:54:26 -08:00
parent 909d5e9a88
commit 7375b5279d
5 changed files with 20 additions and 17 deletions

View File

@@ -1,3 +1,4 @@
#jasmine-ruby is currently designed for use with bundler 0.8.0
gem "rake", "0.8.7"
gem "jeweler", "1.4.0"
gem "gemcutter", "0.2.1"

View File

@@ -1,5 +1,5 @@
---
:patch: 3
:patch: 4
:major: 0
:build:
:minor: 4

View File

@@ -1,15 +1,15 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{jasmine}
s.version = "0.4.3"
s.version = "0.4.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Rajan Agaskar", "Christian Williams"]
s.date = %q{2010-01-28}
s.date = %q{2010-02-16}
s.default_executable = %q{jasmine}
s.description = %q{Javascript BDD test framework}
s.email = %q{ragaskar@gmail.com}

View File

@@ -12,7 +12,17 @@ module Jasmine
end
def call(env)
run
return not_found if env["PATH_INFO"] != "/"
return [200,{ 'Content-Type' => 'text/html' }, ''] if (env['REQUEST_METHOD'] == 'HEAD')
run if env['REQUEST_METHOD'] == 'GET'
end
def not_found
body = "File not found: #{@path_info}\n"
[404, {"Content-Type" => "text/plain",
"Content-Length" => body.size.to_s,
"X-Cascade" => "pass"},
[body]]
end
#noinspection RubyUnusedLocalVariable
@@ -59,8 +69,6 @@ module Jasmine
class FocusedSuite
def initialize(config)
@config = config
# @spec_files_or_proc = spec_files_or_proc || []
# @options = options
end
def call(env)
@@ -102,10 +110,10 @@ module Jasmine
app = Rack::Cascade.new([
Rack::URLMap.new({'/' => Rack::File.new(@config.src_dir)}),
Rack::URLMap.new(thin_config),
JsAlert.new
Rack::URLMap.new(thin_config)
# JsAlert.new
])
# Thin::Logging.trace = true
@thin = Thin::Server.new('0.0.0.0', @port, app)
end

View File

@@ -47,7 +47,7 @@ describe Jasmine::Server do
describe "/ page" do
it "should load each js file in order" do
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx")
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'GET')
code.should == 200
body = read(body)
body.should include("\"/src/file1.js")
@@ -56,10 +56,4 @@ describe Jasmine::Server do
end
end
it "should display an error using JS for 404's" do
code, headers, body = @thin_app.call("PATH_INFO" => "/spec/NonExistantFile.js", "SCRIPT_NAME" => "xxx")
code.should == 200 # todo: shouldn't this be 404? will that work with all browsers?
headers["Content-Type"].should == "application/javascript"
read(body).should == "document.write('<p>Couldn\\'t load /spec/NonExistantFile.js!</p>');"
end
end