forked from thoughtbot/factory_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issues with some attributes being skipped and added support for…
… linked associations in step definitions
- Loading branch information
Joe Ferris
committed
Sep 15, 2009
1 parent
15f36c8
commit 33b61c3
Showing
9 changed files
with
83 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default: -r features features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
Then /^I should find the following for the last post:$/ do |table| | ||
last_post = Post.last or raise "No posts exist" | ||
attributes = table.rows.inject({}) {|res, (key, value)| res.merge(key => value) } | ||
Then /^I should find the following for the last (.*):$/ do |model, table| | ||
model_class = model.camelize.constantize | ||
last_instance = model_class.last or raise "No #{model.pluralize} exist" | ||
attributes = table.raw.inject({}) {|res, (key, value)| res.merge(key => value) } | ||
attributes.each do |key, value| | ||
last_post.attributes[key].should == value | ||
last_instance.attributes[key].to_s.should == value | ||
end | ||
end | ||
|
||
Then /^there should be (\d+) posts$/ do |count| | ||
Post.count.should == count.to_i | ||
Then /^there should be (\d+) (.*)$/ do |count, model| | ||
model_class = model.singularize.camelize.constantize | ||
model_class.count.should == count.to_i | ||
end | ||
|
||
Before do | ||
Post.delete_all | ||
User.delete_all | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters