README.md in formulaic-0.0.6 vs README.md in formulaic-0.1.0
- old
+ new
@@ -25,11 +25,11 @@
### `fill_form`
```ruby
-fill_form(model_name, attributes)
+fill_form(model_name, action = :new, attributes)
```
`fill_form` provides an interface to completely filling out a form. Provide the
`model_name` as a symbol and `attributes` as a hash of
`column name => database value` or `label string => database value`.
@@ -67,17 +67,36 @@
```
The `model_name` and `action` should match up to the
`helpers.submit.<model_name>.<action>` translations.
+### `fill_form_and_submit`
+
+```ruby
+fill_form_and_submit(:user, action = :new, attributes)
+```
+
+Effectively a `fill_form` followed by `click_on submit`, but smart enough to
+`fill_form` with `:new` and `submit` with `:create` and the edit/update cousin.
+
+### Nested Forms
+
+If you have nested forms, through `fields_for` (or any variant), you are able to
+fill them with an extra call to `fill_form`.
+
+```ruby
+fill_form(main_model_name, main_model_attributes)
+fill_form(nested_model_name, nested_model_attributes)
+```
+
### Integration with RSpec:
```ruby
# spec/spec_helper.rb
RSpec.configure do |config|
- config.include Formulaic::Dsl
+ config.include Formulaic::Dsl, type: :feature
end
```
### Integration with Minitest or Test::Unit:
@@ -130,20 +149,23 @@
| `String` | `fill_in`, `choose`, or `select` |
| `Date`, `ActiveSupport::TimeWithZone` | `select` year, month, and day |
| `TrueClass` | `check` |
| `FalseClass` | `uncheck` |
| `Array` | `check` each array member, which should all be strings |
+ | `File` | `attach_file` with `File#path` |
* Formulaic is currently tied to `simple_form` translations and field structure.
If you pass a string for the attribute, we’ll try to fill the input that
relates to that label. We would be happy to work with you to add support for
other form builders.
* Formulaic currently does not support forms with duplicate labels, as it is
designed to be as similar as possible to a user completing a form—it looks at
the labels to determine where to fill what data.
* Formulaic can’t figure out how to fill fields with HTML labels:
`page.fill_in('<strong>Text</strong> here', with: 'something')` doesn’t work
- with Capybara. The usual workaround is to pass a CSS selector.
+ with Capybara. The usual workaround is to pass a CSS selector (which you can
+ do by passing a string as the attribute key).
+* Formulaic can't handle multiple file attachments on the same input.
## About
Formulaic is maintained by [Caleb Thompson](http://github.com/calebthompson).
It was written by [thoughtbot](http://thoughtbot.com) with the help of our