1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/features/step_definitions/database_steps.rb

16 lines
411 B
Ruby
Raw Normal View History

2009-09-15 15:47:47 -04:00
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) }
attributes.each do |key, value|
last_post.attributes[key].should == value
end
end
2009-09-15 15:54:21 -04:00
Then /^there should be (\d+) posts$/ do |count|
Post.count.should == count.to_i
end
Before do
Post.delete_all
end