README.md in chop-0.12.0 vs README.md in chop-0.13.0
- old
+ new
@@ -12,16 +12,17 @@
end
```
## Usage
-Chop monkeypatches Cucumber tables with two new methods:
+Chop monkeypatches Cucumber tables with three new methods:
* `#build!`: Creates ActiveRecord instances. Also supports FactoryGirl.
* `#diff!`: Enhances existing method to also accept a CSS selector. Currently supports diffing `<table>`, `<dl>`, and `<ul>`.
+* `#fill_in!`: Fills in a form on the current page.
-Both these methods accept blocks for customization.
+All these methods accept blocks for customization.
### Block methods for `#build!`:
Transform the attributes hash derived from the table before passing to `ActiveRecord.create!`.
@@ -40,10 +41,14 @@
### Block methods for `#diff!`:
TODO: Pending API overhaul.
+### Block methods for `#fill_in!`:
+
+TODO: Does this make sense?
+
### Example
```gherkin
# features/manage_industries.feature
@@ -56,10 +61,16 @@
| industry | image | headline |
| Example industry | example.jpg | Example headline |
| Example industry | example.jpg | Another headline |
Given I am on the home page
+
+When I fill in the following form:
+ | Name | NEW industry |
+ | Wall background | NEW_wall.jpg |
+ | Table background | NEW_table.jpg |
+
Then I should see the following industries:
| ANOTHER INDUSTRY |
| EXAMPLE INDUSTRY |
And I should see the following "EXAMPLE INDUSTRY" stories:
| IMAGE | HEADLINE |
@@ -81,15 +92,23 @@
end
Given "the following stories exist:" do |table|
table.create! factory_girl: "conversation_table/story" do
belongs_to :industry, ConversationTable::Industry
+
rename :image => :image_file
file :image_file
+
+ # The previous two lines can also be expressed as:
+ file :image => :image_file
end
end
+When "I fill in the following form:" do |table|
+ table.fill_in!
+end
+
Then "I should see the following industries:" do |table|
table.diff! "dl"
end
Then /^I should see the following "(.+?)" stories:$/ do |industry_name, table|
@@ -104,9 +123,10 @@
Load `chop` before `cucumber` in your Gemfile, and call the two methods directly on the `Chop` module, passing the cucumber table in as the first argument.
```ruby
Chop.build! table, Users
Chop.diff! table, "table"
+Chop.fill_in! table
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.