rod 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +7 -0
  2. data/{README → README.rdoc} +33 -2
  3. data/Rakefile +7 -2
  4. data/changelog.txt +13 -0
  5. data/contributors.txt +2 -0
  6. data/features/append.feature +221 -0
  7. data/features/assoc_indexing.feature +66 -0
  8. data/features/basic.feature +199 -0
  9. data/features/collection.feature +171 -0
  10. data/features/flat_indexing.feature +140 -0
  11. data/features/fred.feature +49 -0
  12. data/features/inheritence.feature +211 -0
  13. data/features/muliple_db.feature +113 -0
  14. data/features/relationships.feature +195 -0
  15. data/features/segmented_indexing.feature +172 -0
  16. data/features/steps/model.rb +386 -0
  17. data/features/steps/rod.rb +71 -0
  18. data/features/steps/test_helper.rb +5 -0
  19. data/lib/rod/abstract_database.rb +17 -5
  20. data/lib/rod/constants.rb +1 -1
  21. data/lib/rod/database.rb +95 -74
  22. data/lib/rod/join_element.rb +6 -2
  23. data/lib/rod/model.rb +37 -9
  24. data/rod.gemspec +15 -12
  25. data/tests/check_strings.rb +10 -0
  26. data/tests/class_compatibility_create.rb +14 -0
  27. data/tests/class_compatibility_verify.rb +18 -0
  28. data/tests/eff1_test.rb +60 -0
  29. data/tests/eff2_test.rb +61 -0
  30. data/tests/full_runs.rb +68 -0
  31. data/tests/generate_classes_create.rb +25 -0
  32. data/tests/generate_classes_model.rb +23 -0
  33. data/tests/generate_classes_rewrite.rb +7 -0
  34. data/tests/generate_classes_verify.rb +46 -0
  35. data/tests/load_struct.rb +24 -0
  36. data/tests/migration_create.rb +25 -0
  37. data/tests/migration_migrate.rb +22 -0
  38. data/tests/migration_model1.rb +23 -0
  39. data/tests/migration_model2.rb +27 -0
  40. data/tests/migration_verify.rb +56 -0
  41. data/tests/mock_tests.rb +128 -0
  42. data/tests/read_on_create.rb +45 -0
  43. data/tests/save_struct.rb +49 -0
  44. data/tests/structures.rb +52 -0
  45. data/tests/unit/database.rb +60 -0
  46. data/tests/unit/model.rb +36 -0
  47. data/tests/unit/model_tests.rb +116 -0
  48. data/tests/validate_read_on_create.rb +12 -0
  49. data/utils/convert_index.rb +31 -0
  50. metadata +77 -28
@@ -0,0 +1,171 @@
1
+ Feature: model as a collection of objects
2
+ In order to fullfil its design goals, Rod should allow to store large
3
+ numbers of objects and faciliate their retrieval.
4
+
5
+ Background:
6
+ Given the library works in development mode
7
+
8
+ Scenario: enumerator behavior
9
+ The model should provide enumerator behavior (each, find, select, etc.).
10
+ Given the class space is cleared
11
+ And the model is connected with the default database
12
+ And a class User has a name field of type string
13
+ And a class User has a surname field of type string
14
+ And a class User has a login field of type string
15
+ And a class User has an age field of type integer
16
+ When database is created
17
+ And I create and store the following User(s):
18
+ | name | surname | login | age |
19
+ | John | Smith | john | 12 |
20
+ | Lara | Croft | lara | 23 |
21
+ | Adam | Parker | adam | 17 |
22
+ | Adam | | noob1 | 33 |
23
+ | | | noob2 | -1 |
24
+ And I reopen database for reading
25
+ Then there should be 5 User(s)
26
+ And I should be able to iterate over these User(s)
27
+ And I should be able to iterate with index over these User(s)
28
+ And I should be able to find a User with '12' age and 'john' login
29
+ And I should be able to find a User with '23' age and 'Croft' surname
30
+ And I should be able to find a User with '17' age and 'Adam' name
31
+ And I should be able to find a User with '' name and 'noob1' login
32
+ And I should be able to find a User with '' name and '' surname
33
+ And there should be 3 User(s) with age below 20
34
+ And there should be 2 User(s) with age above 20
35
+ And there should be 1 User with age below 20 with index below 2
36
+
37
+ Scenario: multiple object
38
+ The database should properly store thousands of objects.
39
+ Given the class space is cleared
40
+ And the model is connected with the default database
41
+ And a class User has a name field of type string
42
+ And a class User has a surname field of type string
43
+ And a class User has an age field of type integer
44
+ When database is created
45
+ And I create a User
46
+ And his name is 'John'
47
+ And his surname is 'Smith'
48
+ And his age is '21'
49
+ And I store him in the database 10000 times
50
+ And I create a User
51
+ And her name is 'Lara'
52
+ And her surname is 'Croft'
53
+ And her age is '23'
54
+ And I store her in the database 10000 times
55
+ And I reopen database for reading
56
+ Then there should be 20000 User(s)
57
+ Then User(s) from 1 to 10000 should have 'John' name
58
+ Then User(s) from 10001 to 20000 should have 'Lara' name
59
+
60
+ Scenario: multiple object with has one relationship
61
+ The database should properly store thousands of objects with has many relationship.
62
+ Given the class space is cleared
63
+ And the model is connected with the default database
64
+ And a class Automobile has a name field of type string
65
+ And a class User has a name field of type string
66
+ And a class User has a surname field of type string
67
+ And a class User has an age field of type integer
68
+ And a class User has one automobile
69
+ When database is created
70
+ And I create an Automobile
71
+ And its name is 'Modern car'
72
+ And I store it in the database
73
+ And I create a User
74
+ And his name is 'John'
75
+ And his surname is 'Smith'
76
+ And his age is '21'
77
+ And his automobile is the first Automobile created
78
+ And I store him in the database 10000 times
79
+ And I reopen database for reading
80
+ Then there should be 10000 User(s)
81
+ Then User(s) from 1 to 10000 should have an automobile equal to the first Automobile
82
+
83
+ Scenario: multiple object with has many relationship
84
+ The database should properly store thousands of objects with has many relationship.
85
+ Given the class space is cleared
86
+ And the model is connected with the default database
87
+ And a class Automobile has a name field of type string
88
+ And a class User has a name field of type string
89
+ And a class User has a surname field of type string
90
+ And a class User has an age field of type integer
91
+ And a class User has many automobiles
92
+ When database is created
93
+ And I create an Automobile
94
+ And its name is 'Prehistoric car'
95
+ And I store it in the database
96
+ And I create another Automobile
97
+ And its name is 'Modern car'
98
+ And I store it in the database
99
+ And I create a User
100
+ And his name is 'John'
101
+ And his surname is 'Smith'
102
+ And his age is '21'
103
+ And his automobiles contain the first Automobile created
104
+ And his automobiles contain the second Automobile created
105
+ And I store him in the database 10000 times
106
+ Then User(s) from 1 to 10000 should have 2 automobiles
107
+ And User(s) from 1 to 10000 should have first of automobiles equal to the first Automobile created
108
+ And User(s) from 1 to 10000 should have second of automobiles equal to the second Automobile created
109
+
110
+ Scenario: multiple object with has one polymorphic relationship
111
+ The database should properly store thousands of objects with has many relationship.
112
+ Given the class space is cleared
113
+ And the model is connected with the default database
114
+ And a class Automobile has a name field of type string
115
+ And a class Dog has a nickname field of type string
116
+ And a class User has a name field of type string
117
+ And a class User has one polymorphic item
118
+ When database is created
119
+ And I create an Automobile
120
+ And its name is 'Modern car'
121
+ And I store it in the database
122
+ And I create a User
123
+ And his name is 'John'
124
+ And his item is the first Automobile created
125
+ And I store him in the database 10000 times
126
+ And I create a Dog
127
+ And its nickname is 'Snoopy'
128
+ And I store it in the database
129
+ And I create a User
130
+ And her name is 'Amy'
131
+ And her item is the first Dog created
132
+ And I store her in the database 10000 times
133
+ And I reopen database for reading
134
+ Then there should be 20000 User(s)
135
+ Then User(s) from 1 to 10000 should have an item equal to the first Automobile
136
+ Then User(s) from 10001 to 20000 should have an item equal to the first Dog
137
+
138
+ Scenario: multiple object with has many polymorphic relationship
139
+ The database should properly store thousands of objects with has many relationship.
140
+ Given the class space is cleared
141
+ And the model is connected with the default database
142
+ And a class Automobile has a name field of type string
143
+ And a class Dog has a nickname field of type string
144
+ And a class User has a name field of type string
145
+ And a class User has many polymorphic items
146
+ When database is created
147
+ And I create an Automobile
148
+ And its name is 'Prehistoric car'
149
+ And I store it in the database
150
+ And I create another Automobile
151
+ And its name is 'Modern car'
152
+ And I store it in the database
153
+ And I create a User
154
+ And his name is 'John'
155
+ And his items contain the first Automobile created
156
+ And his items contain the second Automobile created
157
+ And I store him in the database 10000 times
158
+ And I create a Dog
159
+ And its nickname is 'Snoopy'
160
+ And I store it in the database
161
+ And I create a User
162
+ And her name is 'Amy'
163
+ And her items contain the first Automobile created
164
+ And her items contain the second Automobile created
165
+ And her items contain the first Dog created
166
+ And I store her in the database 10000 times
167
+ Then User(s) from 1 to 10000 should have 2 items
168
+ And User(s) from 10001 to 20000 should have 3 items
169
+ And User(s) from 1 to 20000 should have first of items equal to the first Automobile created
170
+ And User(s) from 1 to 20000 should have second of items equal to the second Automobile created
171
+ And User(s) from 10001 to 20000 should have third of items equal to the first Dog created
@@ -0,0 +1,140 @@
1
+ Feature: Access to objects with indexed fields
2
+ ROD allows for accessing objects via fields with indices.
3
+
4
+ Background:
5
+ Given the library works in development mode
6
+
7
+ Scenario: simple indexing
8
+ Rod should allow to access objects via values of their fields,
9
+ for which indices were built.
10
+ Given the class space is cleared
11
+ And the model is connected with the default database
12
+ And a class Caveman has a name field of type string with flat index
13
+ And a class Caveman has an age field of type integer with flat index
14
+ And a class Caveman has an identifier field of type ulong with flat index
15
+ And a class Caveman has a height field of type float with flat index
16
+ When database is created
17
+ And I create a Caveman
18
+ And his name is 'Fred'
19
+ And his age is '25'
20
+ And his identifier is '111122223333'
21
+ And his height is '1.86'
22
+ And I store him in the database
23
+ And I create another Caveman
24
+ And his name is 'Barney'
25
+ And his age is '26'
26
+ And his identifier is '111122224444'
27
+ And his height is '1.67'
28
+ And I store him in the database
29
+ And I create another Caveman
30
+ And his name is 'Wilma'
31
+ And his age is '25'
32
+ And his identifier is '111122225555'
33
+ And his height is '1.67'
34
+ And I store him in the database
35
+ And I reopen database for reading
36
+ Then there should be 3 Caveman(s)
37
+ And there should be 1 Caveman with 'Fred' name
38
+ And there should be 1 Caveman with 'Wilma' name
39
+ And there should be 1 Caveman with 'Barney' name
40
+ And there should be 2 Caveman(s) with '25' age
41
+ And there should be 1 Caveman with '26' age
42
+ And there should be 1 Caveman with '111122223333' identifier
43
+ And there should be 1 Caveman with '111122224444' identifier
44
+ And there should be 1 Caveman with '111122225555' identifier
45
+ And there should be 2 Caveman(s) with '1.67' height
46
+ And there should be 1 Caveman with '1.86' height
47
+
48
+ Scenario: indexing of fields with different DBs for the same model
49
+ The contents of indices should be fulshed when the database is reopened.
50
+ Given the class space is cleared
51
+ And the model is connected with the default database
52
+ And a class Caveman has a name field of type string with flat index
53
+ When database is created
54
+ And I create a Caveman
55
+ And his name is 'Fred'
56
+ And I store him in the database
57
+ And I create another Caveman
58
+ And his name is 'Fred'
59
+ And I store him in the database
60
+ And I create another Caveman
61
+ And his name is 'Fred'
62
+ And I store him in the database
63
+ And I reopen database for reading
64
+ And I access the Caveman name index
65
+ And database is created in location2
66
+ And I create a Caveman
67
+ And his name is 'Wilma'
68
+ And I store him in the database
69
+ And I create another Caveman
70
+ And his name is 'Wilma'
71
+ And I store him in the database
72
+ And I create another Caveman
73
+ And his name is 'Wilma'
74
+ And I store him in the database
75
+ And I reopen database for reading in location2
76
+ Then there should be 3 Caveman(s)
77
+ And there should be 3 Caveman(s) with 'Wilma' name
78
+ And there should be 0 Caveman(s) with 'Fred' name
79
+
80
+ Scenario: indexing of particular values
81
+ Given the class space is cleared
82
+ And the model is connected with the default database
83
+ And a class Caveman has a name field of type string with flat index
84
+ And a class Caveman has a surname field of type string with flat index
85
+ And a class Caveman has a login field of type string with flat index
86
+ And a class Caveman has an age field of type integer with flat index
87
+ When database is created
88
+ And I create and store the following Caveman(s):
89
+ | name | surname | login | age |
90
+ | John | Smith | john | 12 |
91
+ | Lara | Croft | lara | 23 |
92
+ | Adam | Parker | adam | 12 |
93
+ | Adam | | noob1 | 33 |
94
+ | | | noob2 | -1 |
95
+ And I reopen database for reading
96
+ Then there should be 5 Caveman(s)
97
+ And there should be 1 Caveman with 'John' name
98
+ And there should be 2 Caveman(s) with 'Adam' name
99
+ And there should be 2 Caveman(s) with '12' age
100
+ And there should be 1 Caveman with '-1' age
101
+ And there should be 1 Caveman with '' name
102
+ And there should be 2 Caveman(s) with '' surname
103
+
104
+ Scenario: multiple object with indexed fields
105
+ The database should properly store thausands of objects with some indexed fields.
106
+ Given the class space is cleared
107
+ And the model is connected with the default database
108
+ And a class User has a name field of type string with flat index
109
+ And a class User has a surname field of type string with flat index
110
+ And a class User has an age field of type integer
111
+ When database is created
112
+ And I create a User
113
+ And his name is 'John'
114
+ And his surname is 'Smith'
115
+ And his age is '21'
116
+ And I store him in the database 1000 times
117
+ And I create a User
118
+ And her name is 'Lara'
119
+ And her surname is 'Croft'
120
+ And her age is '23'
121
+ And I store her in the database 1000 times
122
+ And I reopen database for reading
123
+ Then there should be 2000 User(s)
124
+ Then there should be 1000 User(s) with 'John' name
125
+ Then there should be 1000 User(s) with 'Smith' surname
126
+ Then there should be 1000 User(s) with 'Lara' name
127
+ Then there should be 1000 User(s) with 'Croft' surname
128
+
129
+ Scenario: reading indices when the DB is created
130
+ It should be possible to access indices for objects which are already
131
+ stored in the DB.
132
+ Given the class space is cleared
133
+ And the model is connected with the default database
134
+ And a class User has a name field of type string with flat index
135
+ When database is created
136
+ And I create a User
137
+ And his name is 'John'
138
+ And I store him in the database
139
+ Then there should exist a User with 'John' name
140
+ And there should be 1 User with 'John' name
@@ -0,0 +1,49 @@
1
+ Feature: ROD Storage
2
+ In order to persist data
3
+ Potential users
4
+ Must be able to store and load their objects.
5
+ Background:
6
+ Given the library works in development mode
7
+ And the class space is cleared
8
+ And the model is connected with the default database
9
+ And a class Fred has an age field of type integer
10
+ And a class Fred has a sex field of type string with flat index
11
+
12
+ Scenario Outline: Store Fred and modify his age
13
+ So far Rod doesn't support changing of objects (especially
14
+ plural associations). To keep the behavior consisten for
15
+ all types of data, fields shouldn't be modifiable as well.
16
+ When database is created
17
+ And I create a Fred
18
+ And his age is '<init_age>'
19
+ And I store him in the database
20
+ And his age is '<grown_age>'
21
+ And I reopen database for reading
22
+ Then there should be 1 Fred
23
+ And the age of the first Fred should be '<init_age>'
24
+
25
+ Examples:
26
+ | init_age | grown_age |
27
+ | 2 | 3 |
28
+ | 8 | 28 |
29
+
30
+ Scenario Outline: Store a few Freds of different sexes. Count restored by sex.
31
+ When database is created
32
+ And I create a Fred
33
+ And his sex is '<sex1>'
34
+ And I store him in the database
35
+ And I create another Fred
36
+ And his sex is '<sex2>'
37
+ And I store him in the database
38
+ And I create another Fred
39
+ And his sex is '<sex3>'
40
+ And I store him in the database
41
+ And I reopen database for reading
42
+ Then database should be opened for reading
43
+ And there should be <count1> Fred(s) with 'male' sex
44
+ And there should be <count2> Fred(s) with 'female' sex
45
+
46
+ Examples:
47
+ | sex1 | sex2 | sex3 | count1 | count2 |
48
+ | female| male | female | 1 | 2 |
49
+ | male | male | female | 2 | 1 |
@@ -0,0 +1,211 @@
1
+ Feature: Store and load data for classes with inheritence relation
2
+ Background:
3
+ Given the library works in development mode
4
+
5
+ Scenario: two classes: A and B < A, sharing some fields,
6
+ connected to the same database.
7
+
8
+ Given the class space is cleared
9
+ And a class Person inherits from Rod::Model
10
+ And a class Person has a name field of type string
11
+ And a class Person is connected to Database1
12
+ And a class User inherits from Person
13
+ And a class User has a login field of type string
14
+ When Database1 is created
15
+ And I create a Person
16
+ And his name is 'John'
17
+ And I store him in the database
18
+ And I create a User
19
+ And her name is 'Annie'
20
+ And her login is 'ann123'
21
+ And I store her in the database
22
+ And I reopen Database1 for reading
23
+ Then there should be 1 Person(s)
24
+ And the name of the first Person should be 'John'
25
+ And the first Person should not have a login field
26
+ And there should be 1 User
27
+ And the name of the first User should be 'Annie'
28
+ And the login of the first User should be 'ann123'
29
+
30
+ Scenario: three classes: A, B < A and C < B sharing some fields,
31
+ connected to the same database.
32
+
33
+ Given the class space is cleared
34
+ And a class Person inherits from Rod::Model
35
+ And a class Person has a name field of type string
36
+ And a class Person is connected to Database1
37
+ And a class User inherits from Person
38
+ And a class User has a login field of type string
39
+ And a class SuperUser inherits from User
40
+ And a class SuperUser has a room field of type string
41
+ When Database1 is created
42
+ And I create a Person
43
+ And his name is 'John'
44
+ And I store him in the database
45
+ And I create a User
46
+ And her name is 'Annie'
47
+ And her login is 'ann123'
48
+ And I store her in the database
49
+ And I create a SuperUser
50
+ And his name is 'Nerd'
51
+ And his login is 'n4rrd'
52
+ And his room is '2-111'
53
+ And I store him in the database
54
+ And I reopen Database1 for reading
55
+ Then there should be 1 Person(s)
56
+ And there should be 1 User(s)
57
+ And there should be 1 SuperUser
58
+ And the name of the first Person should be 'John'
59
+ And the first Person should not have a login field
60
+ And the first Person should not have a room field
61
+ And the name of the first User should be 'Annie'
62
+ And the login of the first User should be 'ann123'
63
+ And the first User should not have a room field
64
+ And the name of the first SuperUser should be 'Nerd'
65
+ And the login of the first SuperUser should be 'n4rrd'
66
+ And the room of the first SuperUser should be '2-111'
67
+
68
+ Scenario: two classes: A and B < A, sharing some fields and has one relations,
69
+ connected to the same database.
70
+
71
+ Given the class space is cleared
72
+ And a class Automobile inherits from Rod::Model
73
+ And a class Automobile has a name field of type string
74
+ And a class Automobile is connected to Database1
75
+ And a class Dog inherits from Rod::Model
76
+ And a class Dog has a name field of type string
77
+ And a class Dog is connected to Database1
78
+ And a class Account inherits from Rod::Model
79
+ And a class Account has a id field of type integer
80
+ And a class Account is connected to Database1
81
+ And a class Person inherits from Rod::Model
82
+ And a class Person has a name field of type string
83
+ And a class Person has one automobile
84
+ And a class Person has one dog
85
+ And a class Person is connected to Database1
86
+ And a class User inherits from Person
87
+ And a class User has a login field of type string
88
+ And a class User has one account
89
+ When Database1 is created
90
+ And I create an Automobile
91
+ And its name is 'Modern'
92
+ And I store it in the database
93
+ And I create a Dog
94
+ And its name is 'Snoopy'
95
+ And I store it in the database
96
+ And I create an Account
97
+ And its id is '100'
98
+ And I store it in the database
99
+ And I create a Person
100
+ And his name is 'John'
101
+ And I store him in the database
102
+ And I create a User
103
+ And her name is 'Annie'
104
+ And her login is 'ann123'
105
+ And her automobile is the first Automobile created
106
+ And her dog is the first Dog created
107
+ And her account is the first Account created
108
+ And I store her in the database
109
+ And I reopen Database1 for reading
110
+ Then there should be 1 Person
111
+ And the name of the first Person should be 'John'
112
+ And the first Person should not have an Account
113
+ And there should be 1 User
114
+ And the name of the first User should be 'Annie'
115
+ And the login of the first User should be 'ann123'
116
+ And the automobile of the first User should be equal to the first Automobile
117
+ And the dog of the first User should be equal to the first Dog
118
+ And the account of the first User should be equal to the first Account
119
+
120
+ Scenario: two classes: A and B < A, sharing some fields and has many relations,
121
+ connected to the same database.
122
+
123
+ Given the class space is cleared
124
+ And a class Automobile inherits from Rod::Model
125
+ And a class Automobile has a name field of type string
126
+ And a class Automobile is connected to Database1
127
+ And a class Dog inherits from Rod::Model
128
+ And a class Dog has a name field of type string
129
+ And a class Dog is connected to Database1
130
+ And a class Account inherits from Rod::Model
131
+ And a class Account has a id field of type integer
132
+ And a class Account is connected to Database1
133
+ And a class Person inherits from Rod::Model
134
+ And a class Person has a name field of type string
135
+ And a class Person has many automobiles
136
+ And a class Person has many dogs
137
+ And a class Person is connected to Database1
138
+ And a class User inherits from Person
139
+ And a class User has a login field of type string
140
+ And a class User has many accounts
141
+ When Database1 is created
142
+ And I create an Automobile
143
+ And its name is 'Modern'
144
+ And I store him in the database
145
+ And I create another Automobile
146
+ And its name is 'Prehistoric'
147
+ And I store him in the database
148
+ And I create a Dog
149
+ And its name is 'Snoopy'
150
+ And I store it in the database
151
+ And I create a Dog
152
+ And its name is 'Pluto'
153
+ And I store it in the database
154
+ And I create an Account
155
+ And its id is '100'
156
+ And I store it in the database
157
+ And I create an Account
158
+ And its id is '200'
159
+ And I store it in the database
160
+ And I create a Person
161
+ And his name is 'John'
162
+ And I store him in the database
163
+ And I create a User
164
+ And her name is 'Annie'
165
+ And her login is 'ann123'
166
+ And her automobiles contain the first Automobile created
167
+ And her automobiles contain the second Automobile created
168
+ And her dogs contain the first Dog created
169
+ And her dogs contain the second Dog created
170
+ And her accounts contain the first Account created
171
+ And her accounts contain the second Account created
172
+ And I store her in the database
173
+ And I reopen Database1 for reading
174
+ Then there should be 1 Person
175
+ And the name of the first Person should be 'John'
176
+ And the first Person should not have an Account
177
+ And there should be 1 User
178
+ And the name of the first User should be 'Annie'
179
+ And the login of the first User should be 'ann123'
180
+ And the first User should have 2 automobiles
181
+ And the first User should have 2 dogs
182
+ And the first User should have 2 accounts
183
+ And the first of automobiles of the first User should be equal to the first Automobile
184
+ And the second of automobiles of the first User should be equal to the second Automobile
185
+ And the first of dogs of the first User should be equal to the first Dog
186
+ And the second of dogs of the first User should be equal to the second Dog
187
+ And the first of accounts of the first User should be equal to the first Account
188
+ And the second of accounts of the first User should be equal to the second Account
189
+
190
+ Scenario: inheritence and polymorphic associations
191
+ It should be possible to access instances of a class inheriting
192
+ directly form Model via polymorhpic association.
193
+ Given the class space is cleared
194
+ And a class Automobile inherits from Rod::Model
195
+ And a class Automobile has a name field of type string
196
+ And a class Automobile is connected to Database1
197
+ And a class Person inherits from Rod::Model
198
+ And a class Person has a name field of type string
199
+ And a class Person has one polymorphic automobile
200
+ And a class Person is connected to Database1
201
+ When Database1 is created
202
+ And I create an Automobile
203
+ And its name is 'Modern'
204
+ And I store him in the database
205
+ And I create a Person
206
+ And his name is 'John'
207
+ And his automobile is the first Automobile created
208
+ And I store him in the database
209
+ Then there should be 1 Person
210
+ And there should be 1 Automobile
211
+ And the automobile of the first Person should be equal to the first Automobile