Skip to content

Commit 91cf211

Browse files
committed
Move testing data into yml files
1 parent 9ab7a01 commit 91cf211

6 files changed

Lines changed: 122 additions & 34 deletions

File tree

test/fixtures/active_record.rb

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,6 @@ class Product < ActiveRecord::Base
437437
has_one :picture, as: :imageable
438438
end
439439

440-
### PORO Data - don't do this in a production app
441-
$breed_data = BreedData.new
442-
$breed_data.add(Breed.new(0, 'persian'))
443-
$breed_data.add(Breed.new(1, 'siamese'))
444-
$breed_data.add(Breed.new(2, 'sphinx'))
445-
$breed_data.add(Breed.new(3, 'to_delete'))
446-
447440
### OperationsProcessor
448441
class CountingActiveRecordOperationsProcessor < ActiveRecordOperationsProcessor
449442
after_find_operation do
@@ -1261,30 +1254,9 @@ class BadlyNamedAttributesResource < JSONAPI::Resource
12611254
end
12621255
warn 'end testing Name Collisions'
12631256

1264-
### PORO DATA
1265-
gas_giant = PlanetType.create(name: 'Gas Giant')
1266-
planetoid = PlanetType.create(name: 'Planetoid')
1267-
terrestrial = PlanetType.create(name: 'Terrestrial')
1268-
sulfuric = PlanetType.create(name: 'Sulfuric')
1269-
unknown = PlanetType.create(name: 'unknown')
1270-
1271-
saturn = Planet.create(name: 'Satern',
1272-
description: 'Saturn is the sixth planet from the Sun and the second largest planet in the Solar System, after Jupiter.',
1273-
planet_type_id: planetoid.id)
1274-
titan = Moon.create(name:'Titan', description: 'Best known of the Saturn moons.', planet_id: saturn.id)
1275-
crater1 = Crater.create(code:'S56D', description: 'Very large crater', moon_id: titan.id)
1276-
crater2 = Crater.create(code:'A4D3', description: 'Small crater', moon_id: titan.id)
1277-
makemake = Planet.create(name: 'Makemake', description: 'A small planetoid in the Kuiperbelt.', planet_type_id: planetoid.id)
1278-
uranus = Planet.create(name: 'Uranus', description: 'Insert adolescent jokes here.', planet_type_id: gas_giant.id)
1279-
jupiter = Planet.create(name: 'Jupiter', description: 'A gas giant.', planet_type_id: gas_giant.id)
1280-
betax = Planet.create(name: 'Beta X', description: 'Newly discovered Planet X', planet_type_id: unknown.id)
1281-
betay = Planet.create(name: 'Beta X', description: 'Newly discovered Planet Y', planet_type_id: unknown.id)
1282-
betaz = Planet.create(name: 'Beta X', description: 'Newly discovered Planet Z', planet_type_id: unknown.id)
1283-
betaw = Planet.create(name: 'Beta W', description: 'Newly discovered Planet W')
1284-
Category.create(name: 'Category A', status: 'active')
1285-
Category.create(name: 'Category B', status: 'active')
1286-
Category.create(name: 'Category C', status: 'active')
1287-
Category.create(name: 'Category D', status: 'inactive')
1288-
Category.create(name: 'Category E', status: 'inactive')
1289-
Category.create(name: 'Category F', status: 'inactive')
1290-
Category.create(name: 'Category G', status: 'inactive')
1257+
### PORO Data - don't do this in a production app
1258+
$breed_data = BreedData.new
1259+
$breed_data.add(Breed.new(0, 'persian'))
1260+
$breed_data.add(Breed.new(1, 'siamese'))
1261+
$breed_data.add(Breed.new(2, 'sphinx'))
1262+
$breed_data.add(Breed.new(3, 'to_delete'))

test/fixtures/categories.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
category_a:
2+
id: 1
3+
name: Category A
4+
status: active
5+
6+
category_b:
7+
id: 2
8+
name: Category B
9+
status: active
10+
11+
category_c:
12+
id: 3
13+
name: Category C
14+
status: active
15+
16+
category_d:
17+
id: 4
18+
name: Category D
19+
status: inactive
20+
21+
category_e:
22+
id: 5
23+
name: Category E
24+
status: inactive
25+
26+
category_f:
27+
id: 6
28+
name: Category F
29+
status: inactive
30+
31+
category_g:
32+
id: 7
33+
name: Category G
34+
status: inactive
35+

test/fixtures/craters.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
crater1:
2+
code: S56D
3+
description: Very large crater
4+
moon_id: 1
5+
6+
crater2:
7+
code: A4D3
8+
description: Small crater
9+
moon_id: 1

test/fixtures/moons.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
titan:
2+
id: 1
3+
name: Titan
4+
description: Best known of the Saturn moons.
5+
planet_id: 1
6+

test/fixtures/planet_types.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
gas_giant:
2+
id: 1
3+
name: Gas Giant
4+
5+
planetoid:
6+
id: 2
7+
name: Planetoid
8+
9+
terrestrial:
10+
id: 3
11+
name: Terrestrial
12+
13+
sulfuric:
14+
id: 4
15+
name: Sulfuric
16+
17+
unknown:
18+
id: 5
19+
name: unknown

test/fixtures/planets.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
saturn:
2+
id: 1
3+
name: Satern
4+
description: Saturn is the sixth planet from the Sun and the second largest planet in the Solar System, after Jupiter.
5+
planet_type_id: 2
6+
7+
makemake:
8+
id: 2
9+
name: Makemake
10+
description: A small planetoid in the Kuiperbelt.
11+
planet_type_id: 2
12+
13+
uranus:
14+
id: 3
15+
name: Uranus
16+
description: Insert adolescent jokes here.
17+
planet_type_id: 1
18+
19+
jupiter:
20+
id: 4
21+
name: Jupiter
22+
description: A gas giant.
23+
planet_type_id: 1
24+
25+
betax:
26+
id: 5
27+
name: Beta X
28+
description: Newly discovered Planet X
29+
planet_type_id: 5
30+
31+
betay:
32+
id: 6
33+
name: Beta X
34+
description: Newly discovered Planet Y
35+
planet_type_id: 5
36+
37+
betaz:
38+
id: 7
39+
name: Beta X
40+
description: Newly discovered Planet Z
41+
planet_type_id: 5
42+
43+
betaw:
44+
id: 8
45+
name: Beta W
46+
description: Newly discovered Planet W
47+
planet_type_id:

0 commit comments

Comments
 (0)