diff --git a/Gemfile b/Gemfile index 3dd5c29f..3179fcbd 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/VERSION.yml b/VERSION.yml index 5db1b22c..5072c566 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- -:patch: 3 +:patch: 4 :major: 0 :build: :minor: 4 diff --git a/jasmine.gemspec b/jasmine.gemspec index c381451d..9c69d1f8 100644 --- a/jasmine.gemspec +++ b/jasmine.gemspec @@ -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} diff --git a/lib/jasmine/server.rb b/lib/jasmine/server.rb index 76f47d9f..07d616e6 100644 --- a/lib/jasmine/server.rb +++ b/lib/jasmine/server.rb @@ -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 diff --git a/spec/server_spec.rb b/spec/server_spec.rb index 73977163..ac87ba4e 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -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('
Couldn\\'t load /spec/NonExistantFile.js!
');" - end end \ No newline at end of file