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

18 lines
504 B
Ruby
Raw Normal View History

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"
table.hashes.first.each do |key, value|
last_instance.attributes[key].to_s.should == value
2009-09-15 15:47:47 -04:00
end
end
Then /^there should be (\d+) (.*)$/ do |count, model|
model_class = model.singularize.camelize.constantize
model_class.count.should == count.to_i
2009-09-15 15:54:21 -04:00
end
Before do
Post.delete_all
User.delete_all
2009-09-15 15:54:21 -04:00
end