README.md in formulaic-0.0.5 vs README.md in formulaic-0.0.6

- old
+ new

@@ -1,7 +1,10 @@ # Formulaic +[![Build Status](https://travis-ci.org/thoughtbot/formulaic.png?branch=master)](https://travis-ci.org/thoughtbot/formulaic) +[![Code Climate](https://codeclimate.com/github/thoughtbot/formulaic.png)](https://codeclimate.com/github/thoughtbot/formulaic) + Remove the tedium of formulaic form filling with Capybara. Formulaic allows you to specify a hash of attributes to be input rather than procedurally calling Capybara’s DSL methods. @@ -10,11 +13,11 @@ ```ruby feature 'New user registration' do scenario 'successfull sign up' do visit sign_in_path - fill_form(:user, { name: 'Caleb', email: 'caleb@thoughtbot.com', 'Terms of Service': true }) + fill_form(:user, { name: 'Caleb', email: 'caleb@thoughtbot.com', 'Terms of Service' => true }) click_on submit(:user) expect(page).to have_content t('user.create.success') end end @@ -74,10 +77,21 @@ RSpec.configure do |config| config.include Formulaic::Dsl end ``` +### Integration with Minitest or Test::Unit: + +```ruby +# test/test_helper.rb + +class ActionDispatch::IntegrationTest + include Capybara::DSL + include Formulaic::Dsl +end +``` + ### Integration with [FactoryGirl](https://github.com/thoughtbot/factory_girl) ```ruby fill_form(:user, attributes_for(:user)) ``` @@ -92,20 +106,32 @@ def sign_up_attributes [:name, :email, :terms_of_service] end ``` +## Assumptions + +Formulaic relies pretty heavily on the assumption that your application is using +translations for SimpleForm and input helpers, using the +`simple_form.labels.<model>.<attribute>` and `helpers.submit.<model>.<action>` +conventions. + +You can still use Formulaic by using strings as keys instead of symbols, which +it knows to pass directly to `fill_in` rather than trying to find a translation. +You’ll need to find submit buttons yourself since `submit` is a thin wrapper +around `I18n.t`. + ## Known Limitations * Formulaic currently supports the following mappings from the `#class` of the attribute values to Capybara method calls: - | Classes | Formulaic’s action | - | --------------------------------------|-------------------------------| - | `String` | `fill_in` | - | `Date`, `ActiveSupport::TimeWithZone` | `select` year, month, and day | - | `TrueClass` | `check` | - | `FalseClass` | `uncheck` | + | Classes | Formulaic’s action | + | --------------------------------------|----------------------------------| + | `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 | * 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