README.md in mortadella-0.1.0 vs README.md in mortadella-0.2.0
- old
+ new
@@ -1,10 +1,12 @@
# Delicious Mock Ruby Tables
[](https://circleci.com/gh/Originate/mortadella)
+[](https://gemnasium.com/Originate/mortadella)
[](LICENSE.txt)
+
Mortadella makes it easy to programmatically build data tables
that can be compared to Cucumber tables
through `cucumber_table.diff! mortadella_table`.
You want to do this as much as possible.
@@ -21,27 +23,72 @@
* run `bundle`
## Usage
+Mortadella supports horizontal and vertical Cucumber tables.
+
+
+### Horizontal Tables
+
* In your cucumber spec, define the expected data in table form
```cucumber
Then I have these ingredients
| INGREDIENT | AMOUNT |
| flour | 12 oz |
| butter | 2 oz |
+ | apples | 3 pc |
```
* in the step definition for this, build an equivalent Mortadella table with the actual data,
and diff the Cucumber table with the expected data against it.
```ruby
Then /^I have these ingredients$/ do |expected_ingredients|
- actual_ingredients = Mortadella.new headers: ['INGREDIENT', 'AMOUNT']
+ actual_ingredients = Mortadella::Horizontal.new headers: ['INGREDIENT', 'AMOUNT']
actual_ingredients << ['flour', '12 oz'] # This data should come from your app
actual_ingredients << ['butter', '2 oz'] # This data should come from your app
+ actual_ingredients << ['apples', '3 pc'] # This data should come from your app
expected_ingredients.diff! actual_ingredients.table
end
```
-* you can also [dry up repetitive fields](https://github.com/Originate/mortadella/blob/master/features/drying_up_fields.feature) for better readability
+* you can also
+ [dry up repetitive fields](https://github.com/Originate/mortadella/blob/master/features/horizontal_tables/drying_up_fields.feature)
+ for better readability
+
+
+### Vertical Tables
+
+* In your cucumber spec, define the expected data in table form
+
+ ```cucumber
+ Then my pie conforms to these specs:
+ | WEIGHT | 2 lbs |
+ | PORTIONS | 8 |
+ | CALORIES | 500 |
+ ```
+
+* in the step definition for this, build an equivalent Mortadella table with the actual data,
+ and diff the Cucumber table with the expected data against it.
+
+ ```ruby
+ Then /^My pie has these metrics:$/ do |expected_metrics|
+ actual_metrics = Mortadella::Vertical.new
+ actual_metrics['WEIGHT'] = '2 lbs' # This data should come from your app
+ actual_metrics['PORTIONS'] = 8 # This data should come from your app
+ actual_metrics['CALORIES'] = 500 # This data should come from your app
+ expected_metrics.diff! actual_metrics.table
+ end
+ ```
+
+
+## Development
+
+* set up local environment: `bundle install`
+* run all tests: `bundle exec rake`
+ * run linter only: `rake lint`
+ * run tests only: `rake features`
+* publish a new gem:
+ * update the version in [mortadella.gemspec](mortadella.gemspec)
+ * `rake release`