fail seed if cannot create

This commit is contained in:
Priit Tark 2015-01-29 18:01:10 +02:00
parent 50673f6dda
commit c1949e7069

View file

@ -14,28 +14,28 @@ registrar1 = Registrar.where(
reg_no: '10300220', reg_no: '10300220',
address: 'Pärnu mnt 2, Tallinna linn, Harju maakond, 11415', address: 'Pärnu mnt 2, Tallinna linn, Harju maakond, 11415',
country: Country.first country: Country.first
).first_or_create ).first_or_create!
ApiUser.where( ApiUser.where(
username: 'registrar1', username: 'registrar1',
password: 'test1', password: 'test1',
active: true, active: true,
registrar: registrar1 registrar: registrar1
).first_or_create ).first_or_create!
registrar2 = Registrar.where( registrar2 = Registrar.where(
name: 'Registrar Second AS', name: 'Registrar Second AS',
reg_no: '10529229', reg_no: '10529229',
address: 'Vabaduse pst 32, 11316 Tallinn', address: 'Vabaduse pst 32, 11316 Tallinn',
country: Country.first country: Country.first
).first_or_create ).first_or_create!
ApiUser.where( ApiUser.where(
username: 'registrar2', username: 'registrar2',
password: 'test2', password: 'test2',
active: true, active: true,
registrar: registrar2 registrar: registrar2
).first_or_create ).first_or_create!
User.where( User.where(
username: 'user1', username: 'user1',
@ -43,7 +43,7 @@ User.where(
email: 'user1@example.ee', email: 'user1@example.ee',
identity_code: '37810013855', identity_code: '37810013855',
country: Country.where(name: 'Estonia').first country: Country.where(name: 'Estonia').first
).first_or_create ).first_or_create!
User.where( User.where(
username: 'user2', username: 'user2',
@ -51,7 +51,7 @@ User.where(
email: 'user2@example.ee', email: 'user2@example.ee',
identity_code: '37810010085', identity_code: '37810010085',
country: Country.where(name: 'Estonia').first country: Country.where(name: 'Estonia').first
).first_or_create ).first_or_create!
User.where( User.where(
username: 'user3', username: 'user3',
@ -59,7 +59,7 @@ User.where(
email: 'user3@example.ee', email: 'user3@example.ee',
identity_code: '37810010727', identity_code: '37810010727',
country: Country.where(name: 'Estonia').first country: Country.where(name: 'Estonia').first
).first_or_create ).first_or_create!
User.update_all(roles: ['admin']) User.update_all(roles: ['admin'])
# Setting.whois_enabled = true only uncomment this if you wish whois # Setting.whois_enabled = true only uncomment this if you wish whois