文件上传 – Rails3,Cucumber,Capybara,文件上传=>内容正文(EOFError)?

我很难让简单的文件上传测试工作.我在使用Cucumber和Capybararuby 1.9.2上使用Rails 3.0.0.

视图:

<%= form_tag "/upload/create",:multipart => true do %>
  <label for="file">File to Upload:</label>
  <%= file_field_tag "file" %>
  <%= submit_tag "Upload" %>
<% end %>

黄瓜步骤:

When /^I upload the basic file$/ do  
  visit path_to("upload")
  path = File.join(::Rails.root,"somefile") 
  attach_file("file",path)
  click_button("Upload")
end

在我的控制器中,除了:

def create
  file = params[:file]
end

Gemfile片段:

group :development,:test do
  # testing with specs
  gem "ZenTest",">= 4.3.3"
  gem "autotest"
  gem "rspec-rails",">= 2.0.0.beta.19",:git => "git://github.com/rspec/rspec-rails.git"
  gem "rspec",:git => "git://github.com/rspec/rspec.git"
  gem "rspec-core",:git => "git://github.com/rspec/rspec-core.git"
  gem "rspec-expectations",:git => "git://github.com/rspec/rspec-expectations.git"
  gem "rspec-mocks",:git => "git://github.com/rspec/rspec-mocks.git"
  # cucumber stuff
  gem 'capybara'
  gem 'database_cleaner'
  gem 'cucumber-rails'
  gem 'cucumber'
  gem 'spork'
  gem 'launchy'    # So you can do Then show me the page
  gem 'escape_utils' # needed to fix Cucumber - http://crimpycode.brennonbortz.com/?p=42
end

当我尝试运行测试时,我收到:

06004

我感谢任何帮助或见解.谢谢.

解决方法

事实证明这是机架测试的一个问题,在更多人采用Rails3和Ruby 1.9.x之前,它可能不会成为大多数问题.

将机架测试升级current master branch修复了问题.
我不确定机架测试何时会在gem中包含这些更改.

也可以看看:
groups.google.com/group/cukes/browse_thread/thread/5028306893c2c54a

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...