jnicklas/capybara — pull request #802 by jarl-dk (2012-09-03 09:19:13+00:00)
Title: Fix for #778

# Fix for issue #778

The pull requests consists of two commits following red-green-refactor flow

Red: A test that demonstrates the problem and the expected behaviour. The expected behavour is "not for discussion" since it is dictaded by the CGI standard on how 'multiple' attribute shall behave
on CGI level.

Green: An implementation (one among many). This may not be an optimal solution but it is quite minimal and it does work using the RakcTest driver. Currently it is not possible to implement this for the Sellenium driver, since the Sellenium driver does not have support for this, see http://code.google.com/p/selenium/issues/detail?id=2239, but that should not prevent capybara from having this feature for other
drivers.

## About the implementation
As far as I can see the current capybara implementation uses the form document (Nokogiri::HTML::Document) to store information about actions for the driver. This has the limitation that only textual information can be transfered from the action methods (lib/capybara/node/actions.rb). So in the case that the action needs to pass an array (a data structure) to the driver then the (Nokogiri::HTML::Document) object is a limitation. However it is still possible; There are several ways that datastructures can be represented as strings, YAML is one of them, and this implementation
is based on that. Another alternative could be to represent the elements in the array as individual text entries, an incomplete implementation of this can be seen on
https://github.com/softace/capybara/commit/58b7858a7619717fe76243e1ff6afcf8efb776cb

## Alternative implementations
A better solution could be to use another data structure (other than Nokogiri::HTML::Document) to pass information from the actions (lib/capybara/node/actions.rb) to the drivers. However that seems to
require a major refactoring of capybara just to make a nicer implementation of one feature. This pull request does not prevent this refactoring, it just doesn't include it.