summaryrefslogtreecommitdiff
path: root/bin/sample.rb
blob: 20ca31b01b9e2107d6e658ba158f178be2554c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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.')

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')

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_expired_license = jd.apply_for_license(WellType::DPT, township_1)
public_expired_license.update_attribute(:issued_at, 1.year.ago)
public_expired_license.update_attribute(:expired_at, 1.day.ago)

confidential_license = hal.apply_for_license(WellType::SPT, township_2)
confidential_license.update_attribute(:issued_at, 1.day.ago)
confidential_license.update_attribute(:expired_at, 1.year.from_now)