Created
January 25, 2017 11:12
-
-
Save stephenrichards/0a09d8d6beefc22c26ef8e25be82908e to your computer and use it in GitHub Desktop.
Rakefile to create people with similar names for peoplefinder test
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
namespace :db do | |
task :pop => :environment do | |
include FactoryGirl::Syntax::Methods | |
Person.where('surname like ?', 'Me%').map(&:destroy) | |
names = [ | |
%w{ Nicky Meadhurst }, | |
%w{ Nicola Meadhurst }, | |
%w{ Nicky Medhurst }, | |
%w{ Nicola Medhurst }, | |
%w{ Jane Meadhurst }, | |
%w{ Jane Medhurst }, | |
%w{ Nicky Meadows }, | |
%w{ Nicola Meadows }, | |
%w{ Nicky Meadows }, | |
%w{ Sveinung Medaas }, | |
%w{ Nikola Medaas } | |
] | |
names.each do |name| | |
person = build :person, given_name: name.first, surname: name.last, email: "#{name.first}.#{name.last}@digital.justice.gov.uk" | |
begin | |
person.save | |
rescue => err | |
puts err.message | |
ap person | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment