Permalink
Browse files

Generalize the single parented detailed object feature

  • Loading branch information...
1 parent 016b36a commit 64146d1ae33cd7d89ee26d4148331c46510d695f @paulelliott paulelliott committed Mar 2, 2012
@@ -17,16 +17,6 @@ Feature: Active Record Objects
| North | Widgets Inc |
Then they should reference that company
- Scenario: a parented single detailed object
- Given 1 company
- And that company has the following division:
- | name | Everyone |
- Then I should see 1 company in the database
- And I should see 1 division in the database
- And I should see the following division in the database:
- | name | Everyone |
- And that division should reference that company
-
Scenario: a parented single detailed object with inheritance
Given 1 company
And that company has the following squadron:
@@ -1,14 +1,5 @@
Feature: Mongoid Objects
- Scenario: a parented single detailed object
- Given 1 author
- And that author has the following book:
- | title | 1984 |
- Then I should see 1 author in the database
- And that book should be persisted
- And that book should have "1984" for a "title"
- And that book should reference that author
-
Scenario: multiple parented detailed objects
Given 1 author
And that author has the following books:
@@ -0,0 +1,16 @@
+Feature: Single Parented Detailed Object
+
+ Scenario Outline:
+ Given 1 <parent fabricator name>
+ And that <parent fabricator name> has the following <child fabricator name>:
+ | number field | 20 |
+ Then I should see 1 <parent fabricator name> in the database
+ And that <child fabricator name> should be persisted
+ And that <child fabricator name> should have "20" for a "number field"
+ And that <child fabricator name> should reference that <parent fabricator name>
+
+ Scenarios:
+ | parent fabricator name | child fabricator name |
+ | parent active record model | child active record model |
+ | parent mongoid document | referenced mongoid document |
+ | parent sequel model | child sequel model |
@@ -26,7 +26,7 @@ def get_class(model_name)
Then /^that ([^"]*) should have "([^"]*)" for a "([^"]*)"$/ do |object_name, value, field|
object_name = dehumanize(object_name)
object = fabrications[object_name]
- object.send(field).should == value
+ object.send(dehumanize(field)).to_s.should == value
end
Then /^they should be persisted$/ do

0 comments on commit 64146d1

Please sign in to comment.