Browse Source

fix seeds

pull/1/head
Claudius Nicolae 12 years ago
parent
commit
b87ba983b4
  1. 11
      db/seeds.rb
  2. 3
      spec/factories.rb

11
db/seeds.rb

@ -1,8 +1,9 @@
Admin.create( admin = Admin.create(
:email => 'admin@entrydns.net', email: 'admin@entrydns.net',
:password => 'garlik1', password: 'garlik1',
:password_confirmation => 'garlik1' password_confirmation: 'garlik1',
) )
admin.update_attribute(:active, true)
puts 'Admin created' puts 'Admin created'
# an user for administrative purposes # an user for administrative purposes
@ -18,7 +19,7 @@ admin.save!
admin.confirm! admin.confirm!
Settings.host_domains.each do |name| Settings.host_domains.each do |name|
host_domain = Domain.new(name: name, user_id: admin.id) host_domain = admin.domains.build(name: name)
host_domain.type = 'NATIVE' host_domain.type = 'NATIVE'
host_domain.setup(admin.email) host_domain.setup(admin.email)
host_domain.save! host_domain.save!

3
spec/factories.rb

@ -3,6 +3,7 @@ FactoryGirl.define do
sequence(:email){|n| "#{Faker::Internet.user_name}#{n}@example.com"} sequence(:email){|n| "#{Faker::Internet.user_name}#{n}@example.com"}
sequence(:password){|n| "password#{n}"} sequence(:password){|n| "password#{n}"}
sequence(:domain_name){|n| "#{n}#{Faker::Internet.domain_name}"} sequence(:domain_name){|n| "#{n}#{Faker::Internet.domain_name}"}
sequence(:domain_word){|n| "#{n}#{Faker::Internet.domain_word}"}
factory :user do factory :user do
first_name {Faker::Name.first_name} first_name {Faker::Name.first_name}
@ -32,7 +33,7 @@ FactoryGirl.define do
end end
factory :a do factory :a do
name {Faker::Internet.domain_word} name {FactoryGirl.generate(:domain_name)}
content {Faker::Internet.ip_v4_address} content {Faker::Internet.ip_v4_address}
end end

Loading…
Cancel
Save