mongo_doc 0.6.26 → 0.6.27
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +14 -203
- data/Rakefile +0 -134
- data/lib/mongo_doc/collection.rb +4 -0
- data/lib/mongo_doc/finders.rb +1 -0
- data/lib/mongo_doc/timestamps.rb +4 -3
- data/lib/mongo_doc/version.rb +3 -0
- data/lib/mongo_doc.rb +0 -5
- metadata +25 -212
- data/.document +0 -5
- data/.gitignore +0 -8
- data/.rspec +0 -2
- data/.rvmrc +0 -1
- data/.watchr +0 -32
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -72
- data/HISTORY.md +0 -11
- data/VERSION +0 -1
- data/examples/simple_document.rb +0 -46
- data/examples/simple_object.rb +0 -34
- data/features/collections.feature +0 -9
- data/features/connection.feature +0 -13
- data/features/db_references.feature +0 -21
- data/features/embed_hash.feature +0 -16
- data/features/finders.feature +0 -76
- data/features/indexes.feature +0 -28
- data/features/mongodb.yml +0 -7
- data/features/mongodoc_base.feature +0 -128
- data/features/new_record.feature +0 -36
- data/features/partial_updates.feature +0 -95
- data/features/polymorphic_collections.feature +0 -16
- data/features/references.feature +0 -28
- data/features/removing_documents.feature +0 -68
- data/features/saving_an_object.feature +0 -15
- data/features/scopes.feature +0 -66
- data/features/step_definitions/collection_steps.rb +0 -17
- data/features/step_definitions/connection_steps.rb +0 -13
- data/features/step_definitions/document_steps.rb +0 -155
- data/features/step_definitions/documents.rb +0 -61
- data/features/step_definitions/embed_hash_steps.rb +0 -6
- data/features/step_definitions/field_steps.rb +0 -28
- data/features/step_definitions/finder_steps.rb +0 -15
- data/features/step_definitions/index_steps.rb +0 -10
- data/features/step_definitions/json_steps.rb +0 -9
- data/features/step_definitions/object_steps.rb +0 -50
- data/features/step_definitions/objects.rb +0 -24
- data/features/step_definitions/partial_update_steps.rb +0 -31
- data/features/step_definitions/query_steps.rb +0 -69
- data/features/step_definitions/removing_documents_steps.rb +0 -14
- data/features/step_definitions/scope_steps.rb +0 -18
- data/features/step_definitions/string_casting_steps.rb +0 -29
- data/features/step_definitions/util_steps.rb +0 -7
- data/features/string_casting.feature +0 -10
- data/features/support/support.rb +0 -12
- data/features/timestamps.feature +0 -14
- data/features/using_criteria.feature +0 -148
- data/mongo_doc.gemspec +0 -272
- data/mongodb.example.yml +0 -14
- data/perf/mongo_doc_object.rb +0 -83
- data/perf/mongo_document.rb +0 -84
- data/perf/ruby_driver.rb +0 -49
- data/script/console +0 -8
- data/spec/active_model_behavior.rb +0 -64
- data/spec/array_including_argument_matcher.rb +0 -62
- data/spec/associations/collection_proxy_spec.rb +0 -233
- data/spec/associations/document_proxy_spec.rb +0 -45
- data/spec/associations/hash_proxy_spec.rb +0 -181
- data/spec/associations/proxy_base_spec.rb +0 -92
- data/spec/associations_spec.rb +0 -218
- data/spec/attributes_accessor_spec.rb +0 -39
- data/spec/attributes_spec.rb +0 -184
- data/spec/bson_matchers.rb +0 -54
- data/spec/bson_spec.rb +0 -196
- data/spec/collection_spec.rb +0 -169
- data/spec/connection_spec.rb +0 -169
- data/spec/contexts/ids_spec.rb +0 -49
- data/spec/contexts/mongo_spec.rb +0 -241
- data/spec/contexts_spec.rb +0 -56
- data/spec/criteria/optional_spec.rb +0 -26
- data/spec/criteria_spec.rb +0 -73
- data/spec/cursor_spec.rb +0 -91
- data/spec/database_cleaner_spec.rb +0 -24
- data/spec/document_ext.rb +0 -9
- data/spec/document_spec.rb +0 -569
- data/spec/embedded_save_spec.rb +0 -73
- data/spec/ext_spec.rb +0 -100
- data/spec/finders_spec.rb +0 -61
- data/spec/hash_matchers.rb +0 -29
- data/spec/index_spec.rb +0 -79
- data/spec/matchers_spec.rb +0 -342
- data/spec/mongodb.yml +0 -6
- data/spec/mongodb_pairs.yml +0 -8
- data/spec/new_record_spec.rb +0 -128
- data/spec/polymorphic_collection_spec.rb +0 -47
- data/spec/references_many_spec.rb +0 -214
- data/spec/references_spec.rb +0 -121
- data/spec/root_spec.rb +0 -41
- data/spec/scope_spec.rb +0 -88
- data/spec/spec_helper.rb +0 -16
- data/spec/timestamps_spec.rb +0 -154
- data/spec/update_spec.rb +0 -167
- data/spec/validations_spec.rb +0 -30
data/features/finders.feature
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
Feature: Finders
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name | Type |
|
7
|
-
| Hashrocket | company |
|
8
|
-
And 'hashrocket' has interests, an array of:
|
9
|
-
| Interest |
|
10
|
-
| ruby |
|
11
|
-
| rails |
|
12
|
-
| employment |
|
13
|
-
| contract work |
|
14
|
-
| restaurants |
|
15
|
-
| hotels |
|
16
|
-
| flights |
|
17
|
-
| car rentals |
|
18
|
-
And 'hashrocket' has many addresses :
|
19
|
-
| Street | City | State | Zip Code |
|
20
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
21
|
-
| 1 Lake Michigan Street | Chicago | IL | 60611 |
|
22
|
-
| 1 Main Street | Santiago | Chile | |
|
23
|
-
And I save the document 'hashrocket'
|
24
|
-
And a Contact document named 'rocketeer' :
|
25
|
-
| Name |
|
26
|
-
| Rocketeer Mike |
|
27
|
-
And 'rocketeer' has interests, an array of:
|
28
|
-
| Interest |
|
29
|
-
| ruby |
|
30
|
-
| rails |
|
31
|
-
| restaurants |
|
32
|
-
| employment |
|
33
|
-
And 'rocketeer' has many addresses :
|
34
|
-
| Street | City | State | Zip Code |
|
35
|
-
| 1 Main Street | Atlantic Beach | FL | 32233 |
|
36
|
-
And I save the document 'rocketeer'
|
37
|
-
And a Contact document named 'contractor' :
|
38
|
-
| Name |
|
39
|
-
| Contractor Joe |
|
40
|
-
And 'contractor' has interests, an array of:
|
41
|
-
| Interest |
|
42
|
-
| ruby |
|
43
|
-
| rails |
|
44
|
-
| contract work |
|
45
|
-
| flights |
|
46
|
-
| car rentals |
|
47
|
-
| hotels |
|
48
|
-
| restaurants |
|
49
|
-
And 'contractor' has many addresses :
|
50
|
-
| Street | City | State | Zip Code |
|
51
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
52
|
-
And I save the document 'contractor'
|
53
|
-
|
54
|
-
Scenario: All
|
55
|
-
When I query contacts with find_all
|
56
|
-
Then the query result has 3 documents
|
57
|
-
|
58
|
-
Scenario: Count
|
59
|
-
When I query contacts with count
|
60
|
-
Then the query result was 3 documents
|
61
|
-
|
62
|
-
Scenario: First
|
63
|
-
When I query contacts with first
|
64
|
-
Then the query result is the document 'hashrocket'
|
65
|
-
|
66
|
-
Scenario: Last
|
67
|
-
When I query contacts with last
|
68
|
-
Then the query result is the document 'contractor'
|
69
|
-
|
70
|
-
Scenario: Find One
|
71
|
-
When I query contacts to find_one with the id of the 'contractor' document
|
72
|
-
Then the query result is the document 'contractor'
|
73
|
-
|
74
|
-
Scenario: Find One by Param
|
75
|
-
When I query contacts to find_one with the to_param of the 'contractor' document
|
76
|
-
Then the query result is the document 'contractor'
|
data/features/indexes.feature
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
Feature: Indexes
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name | Type |
|
7
|
-
| Hashrocket | company |
|
8
|
-
And 'hashrocket' has interests, an array of:
|
9
|
-
| Interest |
|
10
|
-
| ruby |
|
11
|
-
| rails |
|
12
|
-
| employment |
|
13
|
-
| contract work |
|
14
|
-
| restaurants |
|
15
|
-
| hotels |
|
16
|
-
| flights |
|
17
|
-
| car rentals |
|
18
|
-
And 'hashrocket' has many addresses :
|
19
|
-
| Street | City | State | Zip Code |
|
20
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
21
|
-
| 1 Lake Michigan Street | Chicago | IL | 60611 |
|
22
|
-
| 1 Main Street | Santiago | Chile | |
|
23
|
-
And I save the document 'hashrocket'
|
24
|
-
|
25
|
-
Scenario: Simple index
|
26
|
-
When I create an index named name on the Contact collection
|
27
|
-
Then there is an index on name on the Contact collection
|
28
|
-
|
data/features/mongodb.yml
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
Feature: MongoDoc::Base
|
2
|
-
|
3
|
-
Scenario: creating a simple document
|
4
|
-
Given an empty Address document collection
|
5
|
-
And a hash named 'hashrocket':
|
6
|
-
| Street | City | State | Zip Code |
|
7
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
8
|
-
When I create an Address 'address' from the hash 'hashrocket'
|
9
|
-
Then 'address' is not a new record
|
10
|
-
And the Address collection should have 1 document
|
11
|
-
And the document 'address' roundtrips
|
12
|
-
|
13
|
-
Scenario: saving a simple document
|
14
|
-
Given an empty Address document collection
|
15
|
-
And an Address document named 'hashrocket' :
|
16
|
-
| Street | City | State | Zip Code |
|
17
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
18
|
-
When I save the document 'hashrocket'
|
19
|
-
Then 'hashrocket' is not a new record
|
20
|
-
And the Address collection should have 1 document
|
21
|
-
And the document 'hashrocket' roundtrips
|
22
|
-
|
23
|
-
Scenario: updating an attribute of a simple document
|
24
|
-
Given an empty Address document collection
|
25
|
-
And an Address document named 'hashrocket' :
|
26
|
-
| Street | City | State | Zip Code |
|
27
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
28
|
-
And a hash named 'street':
|
29
|
-
| Street |
|
30
|
-
| 320 First St N |
|
31
|
-
And I save the document 'hashrocket'
|
32
|
-
When I update the document 'hashrocket' with the hash named 'street'
|
33
|
-
And the document 'hashrocket' roundtrips
|
34
|
-
Then the attribute 'street' of 'hashrocket' is '320 First St N'
|
35
|
-
|
36
|
-
Scenario: failing to update an attribute of a simple document
|
37
|
-
Given an empty Address document collection
|
38
|
-
And an Address document named 'hashrocket' :
|
39
|
-
| Street | City | State | Zip Code |
|
40
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
41
|
-
And a hash named 'street':
|
42
|
-
| Street |
|
43
|
-
| 320 First St N |
|
44
|
-
And I save the document 'hashrocket'
|
45
|
-
And I set the id on the document 'hashrocket' to 1
|
46
|
-
When I update the document 'hashrocket' with the hash named 'street'
|
47
|
-
Then the last return value is false
|
48
|
-
|
49
|
-
Scenario: saving a has_many document
|
50
|
-
Given an empty Contact document collection
|
51
|
-
And a Contact document named 'hashrocket' :
|
52
|
-
| Name |
|
53
|
-
| Hashrocket |
|
54
|
-
And 'hashrocket' has many addresses :
|
55
|
-
| Street | City | State | Zip Code |
|
56
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
57
|
-
| 1 Main Street | Santiago | Chile | |
|
58
|
-
When I save the document 'hashrocket'
|
59
|
-
Then 'hashrocket' is not a new record
|
60
|
-
And the Contact collection should have 1 document
|
61
|
-
And the document 'hashrocket' roundtrips
|
62
|
-
|
63
|
-
Scenario: saving from a child document
|
64
|
-
Given an empty Contact document collection
|
65
|
-
And a Contact document named 'hashrocket' :
|
66
|
-
| Name |
|
67
|
-
| Hashrocket |
|
68
|
-
And 'hashrocket' has many addresses :
|
69
|
-
| Street | City | State | Zip Code |
|
70
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
71
|
-
| 1 Main Street | Santiago | Chile | |
|
72
|
-
When I save the last document
|
73
|
-
Then 'hashrocket' is not a new record
|
74
|
-
And the Contact collection should have 1 document
|
75
|
-
And the document 'hashrocket' roundtrips
|
76
|
-
|
77
|
-
Scenario: Update attributes from a has_many child document
|
78
|
-
Given an empty Contact document collection
|
79
|
-
And a Contact document named 'hashrocket' :
|
80
|
-
| Name |
|
81
|
-
| Hashrocket |
|
82
|
-
And 'hashrocket' has many addresses :
|
83
|
-
| Street | City | State | Zip Code |
|
84
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
85
|
-
| 1 Main Street | Santiago | Chile | |
|
86
|
-
And I save the last document
|
87
|
-
And that @last is named 'chile'
|
88
|
-
And a hash named 'street':
|
89
|
-
| Street |
|
90
|
-
| 1a Calle |
|
91
|
-
When I update the document 'chile' with the hash named 'street'
|
92
|
-
Then the last return value is true
|
93
|
-
And the document 'hashrocket' roundtrips
|
94
|
-
|
95
|
-
Scenario: update attributes from a has_one child document
|
96
|
-
Given an empty Place document collection
|
97
|
-
And a Place document named 'hashrocket' :
|
98
|
-
| Name |
|
99
|
-
| Hashrocket |
|
100
|
-
And 'hashrocket' has one Address as address :
|
101
|
-
| Street | City | State | Zip Code |
|
102
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
103
|
-
And I save the last document
|
104
|
-
And that @last is named 'address'
|
105
|
-
And a hash named 'street':
|
106
|
-
| Street | City |
|
107
|
-
| 320 1st St. N. | Jax Bch |
|
108
|
-
When I update the document 'address' with the hash named 'street'
|
109
|
-
Then the Place collection should have 1 document
|
110
|
-
And the document 'hashrocket' roundtrips
|
111
|
-
|
112
|
-
Scenario: Class criteria
|
113
|
-
Given an empty Contact document collection
|
114
|
-
And a Contact document named 'hashrocket' :
|
115
|
-
| Name | Type |
|
116
|
-
| Hashrocket | company |
|
117
|
-
And I save the last document
|
118
|
-
When I query contacts with criteria where('type' => 'company')
|
119
|
-
Then the size of the last return value is 1
|
120
|
-
|
121
|
-
Scenario: Finder
|
122
|
-
Given an empty Contact document collection
|
123
|
-
And a Contact document named 'hashrocket' :
|
124
|
-
| Name | Type |
|
125
|
-
| Hashrocket | company |
|
126
|
-
And I save the document 'hashrocket'
|
127
|
-
When I find a contact using the id of 'hashrocket'
|
128
|
-
Then the size of the last return value is 1
|
data/features/new_record.feature
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
Feature: New record
|
2
|
-
|
3
|
-
Scenario: saving a has_many children document
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name |
|
7
|
-
| Hashrocket |
|
8
|
-
And 'hashrocket' has many addresses :
|
9
|
-
| Street | City | State | Zip Code |
|
10
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
11
|
-
| 1 Main Street | Santiago | Chile | |
|
12
|
-
When I save the document 'hashrocket'
|
13
|
-
Then the first address of 'hashrocket' is not a new record
|
14
|
-
|
15
|
-
Scenario: saving a has_one child document
|
16
|
-
Given an empty Place document collection
|
17
|
-
And a Place document named 'hashrocket' :
|
18
|
-
| Name |
|
19
|
-
| Hashrocket |
|
20
|
-
And 'hashrocket' has one Address as address :
|
21
|
-
| Street | City | State | Zip Code |
|
22
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
23
|
-
When I save the document 'hashrocket'
|
24
|
-
Then the address of 'hashrocket' is not a new record
|
25
|
-
|
26
|
-
Scenario: id is roundtripped when saving a has_one child document
|
27
|
-
Given an empty Place document collection
|
28
|
-
And a Place document named 'hashrocket' :
|
29
|
-
| Name |
|
30
|
-
| Hashrocket |
|
31
|
-
And 'hashrocket' has one Address as address :
|
32
|
-
| Street | City | State | Zip Code |
|
33
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
34
|
-
When I save the document 'hashrocket'
|
35
|
-
Then the address of 'hashrocket' roundtrips
|
36
|
-
|
@@ -1,95 +0,0 @@
|
|
1
|
-
Feature: Partial Updates
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name | Type | Note |
|
7
|
-
| Hashrocket | company | Premier Rails development shop! |
|
8
|
-
And 'hashrocket' has interests, an array of:
|
9
|
-
| Interest |
|
10
|
-
| ruby |
|
11
|
-
| rails |
|
12
|
-
| employment |
|
13
|
-
| contract work |
|
14
|
-
| restaurants |
|
15
|
-
| hotels |
|
16
|
-
| flights |
|
17
|
-
| car rentals |
|
18
|
-
And 'hashrocket' has many addresses :
|
19
|
-
| Street | City | State | Zip Code |
|
20
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
21
|
-
| 1 Lake Michigan Street | Chicago | IL | 60611 |
|
22
|
-
| 1 Main Street | Santiago | Chile | |
|
23
|
-
And I save the document 'hashrocket'
|
24
|
-
And a Contact document named 'rocketeer' :
|
25
|
-
| Name | Note |
|
26
|
-
| Rocketeer Mike | Fantastic developer |
|
27
|
-
And 'rocketeer' has interests, an array of:
|
28
|
-
| Interest |
|
29
|
-
| ruby |
|
30
|
-
| rails |
|
31
|
-
| restaurants |
|
32
|
-
| employment |
|
33
|
-
And 'rocketeer' has many addresses :
|
34
|
-
| Street | City | State | Zip Code |
|
35
|
-
| 1 Main Street | Atlantic Beach | FL | 32233 |
|
36
|
-
And I save the document 'rocketeer'
|
37
|
-
And a Contact document named 'contractor' :
|
38
|
-
| Name | Note |
|
39
|
-
| Contractor Joe | Knows MongoDB |
|
40
|
-
And 'contractor' has interests, an array of:
|
41
|
-
| Interest |
|
42
|
-
| ruby |
|
43
|
-
| rails |
|
44
|
-
| contract work |
|
45
|
-
| flights |
|
46
|
-
| car rentals |
|
47
|
-
| hotels |
|
48
|
-
| restaurants |
|
49
|
-
And 'contractor' has many addresses :
|
50
|
-
| Street | City | State | Zip Code |
|
51
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
52
|
-
And I save the document 'contractor'
|
53
|
-
And an empty Place document collection
|
54
|
-
And a Place document named 'hashrocket_hq' :
|
55
|
-
| Name | Type |
|
56
|
-
| Hashrocket | company |
|
57
|
-
And 'hashrocket_hq' has one Address as address (identified by 'hq_address'):
|
58
|
-
| Street | City | State | Zip Code |
|
59
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
60
|
-
And I save the document 'hashrocket_hq'
|
61
|
-
|
62
|
-
Scenario: Update
|
63
|
-
When I update the 'note' for 'contractor' to 'Knows MongoDB and MongoDoc'
|
64
|
-
Then the last return value is true
|
65
|
-
And the document 'contractor' roundtrips
|
66
|
-
|
67
|
-
Scenario: Update on a has one
|
68
|
-
When I update the 'street' for 'hq_address' to '320 1st Street North'
|
69
|
-
Then the last return value is true
|
70
|
-
And the document 'hashrocket_hq' roundtrips
|
71
|
-
|
72
|
-
Scenario: Update on a has many
|
73
|
-
When 'hq_address' is the first address of 'hashrocket'
|
74
|
-
And I update the 'street' for 'hq_address' to '320 1st Street North'
|
75
|
-
Then the last return value is true
|
76
|
-
And the document 'hashrocket' roundtrips
|
77
|
-
|
78
|
-
Scenario: Failing Update on a has one
|
79
|
-
When someone else changes the Address 'address' of 'hashrocket_hq' to
|
80
|
-
| Street | City | State | Zip Code |
|
81
|
-
| 1 Ocean Blvd. | Jacksonville | FL | 32218 |
|
82
|
-
And I update the 'street' for 'hq_address' to '320 1st Street North'
|
83
|
-
Then the last return value is false
|
84
|
-
And the document 'hashrocket_hq' does not roundtrip
|
85
|
-
|
86
|
-
Scenario: Failing Update on a has many
|
87
|
-
When 'hq_address' is the first address of 'hashrocket'
|
88
|
-
And someone else changes the addresses of 'hashrocket':
|
89
|
-
| Street | City | State | Zip Code |
|
90
|
-
| 320 1st N, #712 | Jacksonville Beach | FL | 32250 |
|
91
|
-
| 1001 Mulligan Street | Chicago | IL | 60611 |
|
92
|
-
| 345 Avenida Grande | Santiago | Chile | |
|
93
|
-
And I update the 'street' for 'hq_address' to '320 1st Street North'
|
94
|
-
Then the last return value is false
|
95
|
-
And the document 'hashrocket' does not roundtrip
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Feature: Polymorphic Collections
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Person document collection
|
5
|
-
And a Person document named 'Fry' :
|
6
|
-
| Name |
|
7
|
-
| Philip J. Fry |
|
8
|
-
And a VIP document named 'Leela' :
|
9
|
-
| Name | Title |
|
10
|
-
| Turanga Leela | Captain |
|
11
|
-
|
12
|
-
Scenario: Subclassed documents are in the same collection
|
13
|
-
Given I save the document 'Fry'
|
14
|
-
And I save the document 'Leela'
|
15
|
-
When I query people with count
|
16
|
-
Then the query result is 2 documents
|
data/features/references.feature
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
Feature: References
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Person document collection
|
5
|
-
And a Person document named 'Fry' :
|
6
|
-
| Name |
|
7
|
-
| Philip J. Fry |
|
8
|
-
And an empty Address document collection
|
9
|
-
And an Address document named 'office' :
|
10
|
-
| City |
|
11
|
-
| New New York City |
|
12
|
-
And an Address document named 'old_office' :
|
13
|
-
| City |
|
14
|
-
| New York City |
|
15
|
-
|
16
|
-
Scenario: Automatically dereferences in references association
|
17
|
-
When I save the document 'office'
|
18
|
-
And 'Fry' references 'office' as 'address'
|
19
|
-
And I save the document 'Fry'
|
20
|
-
And the document 'Fry' is reloaded
|
21
|
-
Then 'Fry' refers to 'office' as 'address'
|
22
|
-
|
23
|
-
Scenario: Automatically dereferences in references_many association
|
24
|
-
When I save the document 'old_office'
|
25
|
-
And 'Fry' references 'old_office' through 'previous_addresses'
|
26
|
-
And I save the document 'Fry'
|
27
|
-
And the document 'Fry' is reloaded
|
28
|
-
Then 'Fry' has 'previous_addresses' that include 'old_office'
|
@@ -1,68 +0,0 @@
|
|
1
|
-
Feature: Removing Documents
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name | Type | Note |
|
7
|
-
| Hashrocket | company | Premier Rails development shop! |
|
8
|
-
And 'hashrocket' has interests, an array of:
|
9
|
-
| Interest |
|
10
|
-
| ruby |
|
11
|
-
| rails |
|
12
|
-
| employment |
|
13
|
-
| contract work |
|
14
|
-
| restaurants |
|
15
|
-
| hotels |
|
16
|
-
| flights |
|
17
|
-
| car rentals |
|
18
|
-
And 'hashrocket' has many addresses :
|
19
|
-
| Street | City | State | Zip Code |
|
20
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
21
|
-
| 1 Lake Michigan Street | Chicago | IL | 60611 |
|
22
|
-
| 1 Main Street | Santiago | Chile | |
|
23
|
-
And I save the document 'hashrocket'
|
24
|
-
And a Contact document named 'rocketeer' :
|
25
|
-
| Name | Note |
|
26
|
-
| Rocketeer Mike | Fantastic developer |
|
27
|
-
And 'rocketeer' has interests, an array of:
|
28
|
-
| Interest |
|
29
|
-
| ruby |
|
30
|
-
| rails |
|
31
|
-
| restaurants |
|
32
|
-
| employment |
|
33
|
-
And 'rocketeer' has many addresses :
|
34
|
-
| Street | City | State | Zip Code |
|
35
|
-
| 1 Main Street | Atlantic Beach | FL | 32233 |
|
36
|
-
And I save the document 'rocketeer'
|
37
|
-
And a Contact document named 'contractor' :
|
38
|
-
| Name | Note |
|
39
|
-
| Contractor Joe | Knows MongoDB |
|
40
|
-
And 'contractor' has interests, an array of:
|
41
|
-
| Interest |
|
42
|
-
| ruby |
|
43
|
-
| rails |
|
44
|
-
| contract work |
|
45
|
-
| flights |
|
46
|
-
| car rentals |
|
47
|
-
| hotels |
|
48
|
-
| restaurants |
|
49
|
-
And 'contractor' has many addresses :
|
50
|
-
| Street | City | State | Zip Code |
|
51
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
52
|
-
And I save the document 'contractor'
|
53
|
-
And a Place document named 'hashrocket_hq' :
|
54
|
-
| Name | Type |
|
55
|
-
| Hashrocket | company |
|
56
|
-
And 'hashrocket_hq' has one Address as address (identified by 'hq_address'):
|
57
|
-
| Street | City | State | Zip Code |
|
58
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
59
|
-
And I save the document 'hashrocket_hq'
|
60
|
-
|
61
|
-
Scenario: Simple Remove
|
62
|
-
Given the document 'contractor' roundtrips
|
63
|
-
When I remove 'contractor'
|
64
|
-
Then the document 'contractor' is not found
|
65
|
-
|
66
|
-
Scenario: Embedded Remove
|
67
|
-
When the document 'hashrocket_hq' roundtrips
|
68
|
-
Then an exception is raised if I remove 'hq_address'
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Feature: saving an object
|
2
|
-
|
3
|
-
Scenario: saving simple json
|
4
|
-
Given a new collection named 'test'
|
5
|
-
When I save the json '{"name":"name"}'
|
6
|
-
Then the collection should have 1 document
|
7
|
-
And the json '{"name":"name"}' roundtrips
|
8
|
-
|
9
|
-
Scenario: saving a ruby object
|
10
|
-
Given a new collection named 'test'
|
11
|
-
And an object 'movie'
|
12
|
-
When I save the object 'movie'
|
13
|
-
Then the collection should have 1 document
|
14
|
-
And the object 'movie' roundtrips
|
15
|
-
|
data/features/scopes.feature
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
Feature: Named Scopes
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given an empty Contact document collection
|
5
|
-
And a Contact document named 'hashrocket' :
|
6
|
-
| Name | Type |
|
7
|
-
| Hashrocket | company |
|
8
|
-
And 'hashrocket' has interests, an array of:
|
9
|
-
| Interest |
|
10
|
-
| ruby |
|
11
|
-
| rails |
|
12
|
-
| employment |
|
13
|
-
| contract work |
|
14
|
-
| restaurants |
|
15
|
-
| hotels |
|
16
|
-
| flights |
|
17
|
-
| car rentals |
|
18
|
-
And 'hashrocket' has many addresses :
|
19
|
-
| Street | City | State | Zip Code |
|
20
|
-
| 320 First Street North | Jacksonville Beach | FL | 32250 |
|
21
|
-
| 1 Lake Michigan Street | Chicago | IL | 60611 |
|
22
|
-
| 1 Main Street | Santiago | Chile | |
|
23
|
-
And I save the document 'hashrocket'
|
24
|
-
And a Contact document named 'rocketeer' :
|
25
|
-
| Name |
|
26
|
-
| Rocketeer Mike |
|
27
|
-
And 'rocketeer' has interests, an array of:
|
28
|
-
| Interest |
|
29
|
-
| ruby |
|
30
|
-
| rails |
|
31
|
-
| restaurants |
|
32
|
-
| employment |
|
33
|
-
And 'rocketeer' has many addresses :
|
34
|
-
| Street | City | State | Zip Code |
|
35
|
-
| 1 Main Street | Atlantic Beach | FL | 32233 |
|
36
|
-
And I save the document 'rocketeer'
|
37
|
-
And a Contact document named 'contractor' :
|
38
|
-
| Name |
|
39
|
-
| Contractor Joe |
|
40
|
-
And 'contractor' has interests, an array of:
|
41
|
-
| Interest |
|
42
|
-
| ruby |
|
43
|
-
| rails |
|
44
|
-
| contract work |
|
45
|
-
| flights |
|
46
|
-
| car rentals |
|
47
|
-
| hotels |
|
48
|
-
| restaurants |
|
49
|
-
And 'contractor' has many addresses :
|
50
|
-
| Street | City | State | Zip Code |
|
51
|
-
| 1 Main St. | Jacksonville | FL | 32218 |
|
52
|
-
And I save the document 'contractor'
|
53
|
-
|
54
|
-
Scenario: Simple named scope
|
55
|
-
When I query contacts with scope 'rubyists'
|
56
|
-
Then the query result has 3 documents
|
57
|
-
|
58
|
-
Scenario: Simple chained scope
|
59
|
-
When I query contacts with scopes 'rubyists, contract_work'
|
60
|
-
Then the query result has 2 documents
|
61
|
-
And one of the query results is the document 'contractor'
|
62
|
-
|
63
|
-
Scenario: Named scope with lambda
|
64
|
-
When I query contacts with lambda scope 'in_state' with parameters 'IL'
|
65
|
-
Then the query result has 1 documents
|
66
|
-
And one of the query results is the document 'hashrocket'
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Given /a new collection named '(.*)'/ do |name|
|
2
|
-
MongoDoc::Connection.database.drop_collection(name)
|
3
|
-
@collection = MongoDoc::Collection.new(name)
|
4
|
-
end
|
5
|
-
|
6
|
-
Given /^an empty (\w+) collection$/ do |name|
|
7
|
-
MongoDoc::Connection.database.drop_collection(name)
|
8
|
-
MongoDoc::Connection.database.create_collection(name, :strict => true)
|
9
|
-
end
|
10
|
-
|
11
|
-
Then /the collection should have (\d+) documents?/ do |count|
|
12
|
-
@collection.count.should == count.to_i
|
13
|
-
end
|
14
|
-
|
15
|
-
When "I query the collection '$collection_name' with the criteria $criteria" do |collection_name, criteria|
|
16
|
-
@query = eval("@collection.#{criteria}")
|
17
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Given /^a new connection to the database "([^"]*)" with user "([^"]*)" and password "([^"]*)"$/ do |db, user, password|
|
2
|
-
begin
|
3
|
-
MongoDoc::Connection.connection = Mongo::Connection.from_uri("mongodb://#{user}:#{password}@localhost/#{db}")
|
4
|
-
MongoDoc::Connection.send(:verify_server_version)
|
5
|
-
rescue StandardError => e
|
6
|
-
@exception = e
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
Then /^a "([^"]*)" exception is thrown$/ do |exception|
|
11
|
-
@exception.class.name.should == exception
|
12
|
-
end
|
13
|
-
|