当我运行bundle exec rake jasmine
然后浏览到http://localhost:8888/时,我看到以下错误消息:
No data received
Unable to load the web page because the server sent no data.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
在控制台中,我看到:
[2012-02-08 07:54:08] INFO WEBrick 1.3.1
[2012-02-08 07:54:08] INFO ruby 1.9.2 (2011-07-09) [i686-linux]
[2012-02-08 07:54:08] WARN TCPServer Error: Address already in use - bind(2)
[2012-02-08 07:54:08] INFO WEBrick::HTTPServer#start: pid=12078 port=8888
[2012-02-08 07:54:10] ERROR ArgumentError: wrong number of arguments (2 for 0)
/home/duncan/.rvm/gems/ruby-1.9.2-p290/gems/railroady-1.0.6/tasks/railroady.rake:11:in `format'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:110:in `service'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
[2012-02-08 07:54:10] ERROR ArgumentError: wrong number of arguments (3 for 0)
/home/duncan/.rvm/gems/ruby-1.9.2-p290/gems/railroady-1.0.6/tasks/railroady.rake:11:in `format'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpversion.rb:46:in `to_s'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpresponse.rb:49:in `status_line'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpresponse.rb:170:in `send_header'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpresponse.rb:102:in `send_response'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:86:in `run'
/home/duncan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
spec / javascripts目录的结构是:
spec/javascripts/
├── helpers
│ ├── jasmine_helpers.js.coffee
│ ├── jasmine-jquery-1.3.1.js
│ └── mock-ajax.js
├── models
│ ├── account_spec.js.coffee
│ ├── matrices_spec.js.coffee
│ ├── matrix_spec.js.coffee
│ └── students_spec.js.coffee
├── support
│ ├── jasmine_config.rb
│ ├── jasmine_runner.rb
│ └── jasmine.yml
└── views
├── avia_view_spec.js.coffee
├── matrices_view_spec.js.coffee
├── students_view_spec.js.coffee
└── student_view_spec.js.coffee
我的jasmine.yml文件包含:
src_dir: app/assets/javascripts
asset_paths:
- app/assets/javascripts/views
src_files:
- avia.js
- jquery-1.6.4.js
- jquery.jqGrid.min.js
- underscore.js
- backbone.js
- haml.js
- "**/*"
stylesheets:
- stylesheets/**/*.css
helpers:
- helpers/**/*.js
- helpers/**/*.js.coffee
spec_files:
- '**/*_spec.js.coffee'
spec_dir: spec/javascripts
My Gem版本如下(我已经包含了我认为相关的内容;如果您需要完整列表,请告诉我):
我在Linux Mint 12上运行Chrome 16.0.912.77,使用Ruby 1.9.2-p290到RVM。
此设置通过jasmine-headless-webkit正常工作:
Running Jasmine specs...
............................
PASS: 28 tests, 0 failures, 0.076 secs.
也许我在我的jasmine.yml中做了一些jasmine-gem不支持的事情?
答案 0 :(得分:1)
使用最新的源代码。感谢@avaynshtok指出问题&发送拉请求!
gem 'railroady', :git => "git://github.com/preston/railroady.git"
答案 1 :(得分:0)
这看起来像铁路上的一个错误。当我将它添加到我的Gemfile并运行jasmine时,我看到与您完全相同的错误。 Jasmine工作正常,没有安装铁路。
问题是,railroady在默认范围内的format
中定义了tasks/railroady.rake
函数。
def format
@@DIAGRAM_FORMAT ||= 'svg'
end
这是webrick最终调用的format
,而不是Kernel.format
,导致我们看到的异常。
拿出铁路,看看Jasmine是否有效。