Rails3, Cucumber, Capybara, File upload => bad content body (EOFError) ?

509 views
Skip to first unread message

astjohn

unread,
Sep 15, 2010, 8:26:36 PM9/15/10
to Cukes
All,

I'm having a hard time getting a simple file upload test working. I'm
using Rails 3.0.0 on ruby 1.9.2 with Cucumber and Capybara.

View:

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


Cucumber Step:

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


In my controller, i have commented out everything except for:

def create
file = params[:file]
end


Gemfile snippet:

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


When I try to run the test, I receive:

(::) failed steps (::)
bad content body (EOFError)
<internal:prelude>:10:in `synchronize'

I'm not exactly sure where the problem is originating.
I appreciate any help or insight. Thanks.

aslak hellesoy

unread,
Sep 16, 2010, 4:21:27 AM9/16/10
to cu...@googlegroups.com
We need a full trace. Pass -b to cucumber and gist it please.

Aslak
 
I appreciate any help or insight. Thanks.

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


astjohn

unread,
Sep 16, 2010, 5:55:37 PM9/16/10
to Cukes
You got it.

Please see:
http://gist.github.com/583236

Thanks,
Adam

On Sep 16, 4:21 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> > cukes+un...@googlegroups.com <cukes%2Bunsu...@googlegroups.com>.

Jonas Nicklas

unread,
Sep 16, 2010, 6:15:35 PM9/16/10
to cu...@googlegroups.com
IIRC this is a known issue with rack-test, try upgrading to rack-test
master and see if that fixes it for you!

/Jonas

> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.

astjohn

unread,
Sep 16, 2010, 10:10:49 PM9/16/10
to Cukes
Thanks for tracking this down for me Jonas. That did the trick!

Cheers,
Adam
Reply all
Reply to author
Forward
0 new messages