Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
Generalize the single parented detailed object feature
Browse files Browse the repository at this point in the history
  • Loading branch information
paulelliott committed Mar 2, 2012
1 parent 016b36a commit 64146d1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
10 changes: 0 additions & 10 deletions features/active_record_objects.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 0 additions & 9 deletions features/mongoid_objects.feature
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
16 changes: 16 additions & 0 deletions features/single_parented_detailed_object.feature
Original file line number Diff line number Diff line change
@@ -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 |
2 changes: 1 addition & 1 deletion features/step_definitions/object_verification_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 64146d1

Please sign in to comment.