summaryrefslogtreecommitdiff
path: root/bin/sample.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-22 13:35:05 -0700
committermo khan <mo@mokhan.ca>2014-02-22 13:35:05 -0700
commitf0cd650dbaae9cae6f3a532690c6984b02e4663f (patch)
treefd6bebd8c76714c6c6901459165f77f35c20a84d /bin/sample.rb
parentc55f2a19870e4077f2abdea4ed8db18c42d3b3c9 (diff)
hardcode ids in sample script.
Diffstat (limited to 'bin/sample.rb')
-rwxr-xr-xbin/sample.rb50
1 files changed, 33 insertions, 17 deletions
diff --git a/bin/sample.rb b/bin/sample.rb
index 97bfcf0..5297ff4 100755
--- a/bin/sample.rb
+++ b/bin/sample.rb
@@ -1,25 +1,41 @@
#!/usr/bin/env ruby
require ::File.expand_path('../../config/environment', __FILE__)
-abc_resources = Company.create(name: 'ABC Resources Ltd.')
-xyz_resources = Company.create(name: 'XYZ Resources Ltd.')
+ActiveRecord::Base.transaction do
+ abc_resources = Company.create(id: '680fc2c1-9557-49fd-b05f-0f700a67ca0c', name: 'ABC Resources Ltd.')
+ xyz_resources = Company.create(id: '04e6b076-41ca-4849-8a94-14e4e505ffe8', name: 'XYZ Resources Ltd.')
-jd = User.create(first_name: 'john', last_name: 'dielwart', company: abc_resources)
-hal = User.create(first_name: 'hal', last_name: 'kvisle', company: xyz_resources)
+ jd = User.create(first_name: 'john', last_name: 'dielwart', company: abc_resources)
+ hal = User.create(first_name: 'hal', last_name: 'kvisle', company: xyz_resources)
-township_1 = Location.create(latitude: 51.06, longitude: -114.09, township: '1')
-township_2 = Location.create(latitude: 40.06, longitude: -100.09, township: '2')
-township_3 = Location.create(latitude: 30.06, longitude: -90.01, township: '3')
+ township_1 = Location.create(latitude: 51.06, longitude: -114.09, township: '1')
+ township_2 = Location.create(latitude: 40.06, longitude: -100.09, township: '2')
+ township_3 = Location.create(latitude: 30.06, longitude: -90.01, township: '3')
-public_license = jd.apply_for_license(WellType::NFW, township_1)
-public_license.update_attribute(:issued_at, 1.day.ago)
-public_license.update_attribute(:expired_at, 1.year.from_now)
+ public_license = abc_resources.licenses.create(
+ id: 'e4650fd2-2298-463a-bfcd-fb953d996d6e',
+ well_type: WellType::NFW,
+ location: township_1,
+ applicant: jd,
+ issued_at: 1.day.ago,
+ expired_at: 1.year.from_now
+ )
-public_expired_license = jd.apply_for_license(WellType::DPT, township_3)
-public_expired_license.update_attribute(:issued_at, 1.year.ago)
-public_expired_license.update_attribute(:expired_at, 1.day.ago)
+ public_expired_license = abc_resources.licenses.create(
+ id: '20d69330-ebc9-40b6-9d25-0174aea3c056',
+ well_type: WellType::DPT,
+ location: township_3,
+ applicant: jd,
+ issued_at: 1.year.ago,
+ expired_at: 1.day.ago
+ )
-confidential_license = hal.apply_for_license(WellType::SPT, township_2)
-confidential_license.update_attribute(:confidential, true)
-confidential_license.update_attribute(:issued_at, 1.day.ago)
-confidential_license.update_attribute(:expired_at, 1.year.from_now)
+ confidential_license = xyz_resources.licenses.create(
+ id: 'fd3918dd-6296-49ce-83bb-c518916fb82e',
+ well_type: WellType::SPT,
+ location: township_2,
+ applicant: hal,
+ issued_at: 1.day.ago,
+ expired_at: 1.year.from_now
+ )
+end