Skip to content

Commit

Permalink
Add random users to the dev prime
Browse files Browse the repository at this point in the history
  • Loading branch information
drapergeek committed Nov 18, 2012
1 parent 49fc6b2 commit 85f7643
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -31,6 +31,7 @@ group :development, :test do
gem 'guard-spork'
gem 'rspec-rails'
gem 'sham_rack'
gem 'faker'
end

group :test do
Expand Down
6 changes: 5 additions & 1 deletion lib/tasks/dev.rake
Expand Up @@ -3,6 +3,7 @@ namespace :dev do
task prime: 'db:migrate' do
require 'database_cleaner'
require 'factory_girl_rails'
include FactoryGirl::Syntax::Methods

if Rails.env != "development"
raise "This task can only be create in the development environment"
Expand All @@ -14,7 +15,10 @@ namespace :dev do
puts "Creating development data..."

puts "***USERS***"
user = FactoryGirl.create(:user, email: 'user@example.com', password: 'test')
user = create(:user, email: 'user@example.com', password: 'test')
puts "User: #{user.email}/#{user.password}"
5.times do
create(:random_user)
end
end
end
5 changes: 5 additions & 0 deletions spec/factories.rb
Expand Up @@ -10,5 +10,10 @@
factory :admin_user do
role 'admin'
end

factory :random_user do
name { Faker::Name.name }
email { Faker::Internet.email }
end
end
end

0 comments on commit 85f7643

Please sign in to comment.