Skip to content

Instantly share code, notes, and snippets.

@ascot21
Created November 13, 2012 21:45
Show Gist options
  • Save ascot21/4068607 to your computer and use it in GitHub Desktop.
Save ascot21/4068607 to your computer and use it in GitHub Desktop.
Step definition for mass-assigning "admin"
Given /^there are the following users:$/ do |table|
table.hashes.each do |attributes|
unconfirmed = attributes.delete("unconfirmed") == "true"
admin = attributes.delete("admin") == "true"
@user = User.create!(attributes)
@user.admin = admin
@user.confirm! unless unconfirmed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment