From b87ba983b430d985e81a9efc2d02fa1c422ca310 Mon Sep 17 00:00:00 2001 From: Claudius Nicolae Date: Tue, 5 Mar 2013 11:56:19 +0200 Subject: [PATCH] fix seeds --- db/seeds.rb | 11 ++++++----- spec/factories.rb | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 86461dd..b1efd86 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,8 +1,9 @@ -Admin.create( - :email => 'admin@entrydns.net', - :password => 'garlik1', - :password_confirmation => 'garlik1' +admin = Admin.create( + email: 'admin@entrydns.net', + password: 'garlik1', + password_confirmation: 'garlik1', ) +admin.update_attribute(:active, true) puts 'Admin created' # an user for administrative purposes @@ -18,7 +19,7 @@ admin.save! admin.confirm! 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.setup(admin.email) host_domain.save! diff --git a/spec/factories.rb b/spec/factories.rb index ed990bf..190cc08 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -3,6 +3,7 @@ FactoryGirl.define do sequence(:email){|n| "#{Faker::Internet.user_name}#{n}@example.com"} sequence(:password){|n| "password#{n}"} sequence(:domain_name){|n| "#{n}#{Faker::Internet.domain_name}"} + sequence(:domain_word){|n| "#{n}#{Faker::Internet.domain_word}"} factory :user do first_name {Faker::Name.first_name} @@ -32,7 +33,7 @@ FactoryGirl.define do end factory :a do - name {Faker::Internet.domain_word} + name {FactoryGirl.generate(:domain_name)} content {Faker::Internet.ip_v4_address} end