Sto avendo un momento difficile ottenere un semplice test di lavoro upload di file. Sto usando Rails 3.0.0 su Ruby 1.9.2 con Cucumber e Capybara.Rails3, cetriolo, Capybara, caricati File => corpo contenuto inappropriato (EOFError)?
Vista:
<%= form_tag "/upload/create", :multipart => true do %>
<label for="file">File to Upload:</label>
<%= file_field_tag "file" %>
<%= submit_tag "Upload" %>
<% end %>
Cetriolo Passo:
Nel mio controller, ho commentato tutto tranne che per:
def create
file = params[:file]
end
Gemfile frammento:
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
Quando provo ad eseguire il test, ricevo:
(::) failed steps (::) bad content body (EOFError) <internal:prelude>:10:in `synchronize'
Apprezzo tutto l'aiuto o intuizione. Grazie.
Grazie per avermi aiutato David. Non ho ancora avuto il tempo di provare a ripiegare su webrat e quindi non sono sicuro di dove si verifichi il problema. Finora ho postato su casa di Capybara su Git, ma devo ancora ricevere una risposta. – astjohn