database_cleaner 1.5.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +4 -4
  3. data/History.rdoc +44 -0
  4. data/README.markdown +29 -6
  5. data/VERSION.yml +2 -2
  6. data/lib/database_cleaner/active_record/base.rb +17 -1
  7. data/lib/database_cleaner/active_record/deletion.rb +23 -2
  8. data/lib/database_cleaner/active_record/truncation.rb +2 -2
  9. data/lib/database_cleaner/base.rb +2 -0
  10. data/lib/database_cleaner/mongoid/truncation.rb +1 -1
  11. data/lib/database_cleaner/null_strategy.rb +5 -0
  12. data/lib/database_cleaner/redis/base.rb +1 -1
  13. data/lib/database_cleaner/safeguard.rb +72 -0
  14. data/lib/database_cleaner.rb +6 -2
  15. metadata +6 -91
  16. data/examples/Gemfile +0 -1
  17. data/examples/Gemfile.lock +0 -286
  18. data/examples/config/database.yml +0 -7
  19. data/examples/config/database.yml.example +0 -8
  20. data/examples/config/redis.yml +0 -8
  21. data/examples/db/activerecord_one.db +0 -0
  22. data/examples/db/activerecord_two.db +0 -0
  23. data/examples/db/datamapper_default.db +0 -0
  24. data/examples/db/datamapper_one.db +0 -0
  25. data/examples/db/datamapper_two.db +0 -0
  26. data/examples/db/sqlite_databases_go_here +0 -0
  27. data/examples/features/example.feature +0 -11
  28. data/examples/features/example_multiple_db.feature +0 -23
  29. data/examples/features/example_multiple_orm.feature +0 -22
  30. data/examples/features/step_definitions/activerecord_steps.rb +0 -31
  31. data/examples/features/step_definitions/couchpotato_steps.rb +0 -31
  32. data/examples/features/step_definitions/datamapper_steps.rb +0 -37
  33. data/examples/features/step_definitions/mongoid_steps.rb +0 -23
  34. data/examples/features/step_definitions/mongomapper_steps.rb +0 -31
  35. data/examples/features/step_definitions/neo4j_steps.rb +0 -23
  36. data/examples/features/step_definitions/translation_steps.rb +0 -55
  37. data/examples/features/support/env.rb +0 -61
  38. data/examples/lib/activerecord_models.rb +0 -41
  39. data/examples/lib/couchpotato_models.rb +0 -61
  40. data/examples/lib/datamapper_models.rb +0 -50
  41. data/examples/lib/mongoid_models.rb +0 -44
  42. data/examples/lib/mongomapper_models.rb +0 -51
  43. data/examples/lib/neo4j_models.rb +0 -17
  44. data/examples/lib/ohm_models.rb +0 -43
  45. data/examples/lib/redis_models.rb +0 -65
  46. data/examples/lib/sequel_models.rb +0 -9
  47. data/features/cleaning.feature +0 -30
  48. data/features/cleaning_default_strategy.feature +0 -23
  49. data/features/cleaning_multiple_dbs.feature +0 -22
  50. data/features/cleaning_multiple_orms.feature +0 -67
  51. data/features/step_definitions/database_cleaner_steps.rb +0 -33
  52. data/features/step_definitions/ohm_steps.rb +0 -31
  53. data/features/step_definitions/redis_steps.rb +0 -31
  54. data/features/support/env.rb +0 -4
  55. data/features/support/feature_runner.rb +0 -39
  56. data/spec/database_cleaner/active_record/base_spec.rb +0 -188
  57. data/spec/database_cleaner/active_record/transaction_spec.rb +0 -176
  58. data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +0 -38
  59. data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +0 -38
  60. data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +0 -75
  61. data/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb +0 -40
  62. data/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +0 -40
  63. data/spec/database_cleaner/active_record/truncation_spec.rb +0 -180
  64. data/spec/database_cleaner/base_spec.rb +0 -617
  65. data/spec/database_cleaner/configuration_spec.rb +0 -345
  66. data/spec/database_cleaner/couch_potato/truncation_spec.rb +0 -41
  67. data/spec/database_cleaner/data_mapper/base_spec.rb +0 -30
  68. data/spec/database_cleaner/data_mapper/transaction_spec.rb +0 -23
  69. data/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb +0 -41
  70. data/spec/database_cleaner/data_mapper/truncation_spec.rb +0 -11
  71. data/spec/database_cleaner/generic/base_spec.rb +0 -61
  72. data/spec/database_cleaner/generic/truncation_spec.rb +0 -118
  73. data/spec/database_cleaner/mongo/mongo_examples.rb +0 -26
  74. data/spec/database_cleaner/mongo/truncation_spec.rb +0 -72
  75. data/spec/database_cleaner/mongo_mapper/base_spec.rb +0 -33
  76. data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +0 -8
  77. data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +0 -74
  78. data/spec/database_cleaner/moped/moped_examples.rb +0 -32
  79. data/spec/database_cleaner/moped/truncation_spec.rb +0 -80
  80. data/spec/database_cleaner/neo4j/base_spec.rb +0 -43
  81. data/spec/database_cleaner/neo4j/transaction_spec.rb +0 -25
  82. data/spec/database_cleaner/ohm/truncation_spec.rb +0 -70
  83. data/spec/database_cleaner/redis/base_spec.rb +0 -43
  84. data/spec/database_cleaner/redis/truncation_spec.rb +0 -63
  85. data/spec/database_cleaner/sequel/base_spec.rb +0 -32
  86. data/spec/database_cleaner/sequel/deletion_spec.rb +0 -58
  87. data/spec/database_cleaner/sequel/transaction_spec.rb +0 -21
  88. data/spec/database_cleaner/sequel/truncation/sqlite3_spec.rb +0 -0
  89. data/spec/database_cleaner/sequel/truncation_spec.rb +0 -182
  90. data/spec/database_cleaner/shared_strategy.rb +0 -15
  91. data/spec/rcov.opts +0 -1
  92. data/spec/spec_helper.rb +0 -21
  93. data/spec/support/active_record/database_setup.rb +0 -6
  94. data/spec/support/active_record/migrations/20150101010000_create_users.rb +0 -14
  95. data/spec/support/active_record/migrations/20150101020000_create_agents.rb +0 -14
  96. data/spec/support/active_record/mysql2_setup.rb +0 -39
  97. data/spec/support/active_record/mysql_setup.rb +0 -38
  98. data/spec/support/active_record/postgresql_setup.rb +0 -48
  99. data/spec/support/active_record/schema_setup.rb +0 -17
  100. data/spec/support/active_record/sqlite3_setup.rb +0 -40
  101. data/spec/support/data_mapper/schema_setup.rb +0 -15
  102. data/spec/support/data_mapper/sqlite3_setup.rb +0 -39
@@ -1,286 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- database_cleaner (1.5.2)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- abstract (1.0.0)
10
- actionpack (3.0.0)
11
- activemodel (= 3.0.0)
12
- activesupport (= 3.0.0)
13
- builder (~> 2.1.2)
14
- erubis (~> 2.6.6)
15
- i18n (~> 0.4.1)
16
- rack (~> 1.2.1)
17
- rack-mount (~> 0.6.12)
18
- rack-test (~> 0.5.4)
19
- tzinfo (~> 0.3.23)
20
- activemodel (3.0.0)
21
- activesupport (= 3.0.0)
22
- builder (~> 2.1.2)
23
- i18n (~> 0.4.1)
24
- activerecord (3.0.0)
25
- activemodel (= 3.0.0)
26
- activesupport (= 3.0.0)
27
- arel (~> 1.0.0)
28
- tzinfo (~> 0.3.23)
29
- activerecord-mysql2-adapter (0.0.3)
30
- mysql2
31
- activesupport (3.0.0)
32
- addressable (2.3.6)
33
- arel (1.0.1)
34
- activesupport (~> 3.0.0)
35
- bcrypt (3.1.7)
36
- bcrypt (3.1.7-java)
37
- bcrypt-ruby (3.1.5)
38
- bcrypt (>= 3.1.3)
39
- bcrypt-ruby (3.1.5-java)
40
- bcrypt (>= 3.1.3)
41
- bson (1.11.1)
42
- bson (1.11.1-java)
43
- bson_ext (1.11.1)
44
- bson (~> 1.11.1)
45
- builder (2.1.2)
46
- coderay (1.1.0)
47
- couch_potato (1.3.0)
48
- activemodel
49
- couchrest (~> 1.2.0)
50
- json (~> 1.6)
51
- couchrest (1.2.0)
52
- mime-types (~> 1.15)
53
- multi_json (~> 1.0)
54
- rest-client (~> 1.6.1)
55
- cucumber (1.2.1)
56
- builder (>= 2.1.2)
57
- diff-lcs (>= 1.1.3)
58
- gherkin (~> 2.11.0)
59
- json (>= 1.4.6)
60
- data_objects (0.10.14)
61
- addressable (~> 2.1)
62
- datamapper (1.2.0)
63
- dm-aggregates (~> 1.2.0)
64
- dm-constraints (~> 1.2.0)
65
- dm-core (~> 1.2.0)
66
- dm-migrations (~> 1.2.0)
67
- dm-serializer (~> 1.2.0)
68
- dm-timestamps (~> 1.2.0)
69
- dm-transactions (~> 1.2.0)
70
- dm-types (~> 1.2.0)
71
- dm-validations (~> 1.2.0)
72
- diff-lcs (1.2.5)
73
- dm-aggregates (1.2.0)
74
- dm-core (~> 1.2.0)
75
- dm-constraints (1.2.0)
76
- dm-core (~> 1.2.0)
77
- dm-core (1.2.1)
78
- addressable (~> 2.3)
79
- dm-do-adapter (1.2.0)
80
- data_objects (~> 0.10.6)
81
- dm-core (~> 1.2.0)
82
- dm-migrations (1.2.0)
83
- dm-core (~> 1.2.0)
84
- dm-serializer (1.2.2)
85
- dm-core (~> 1.2.0)
86
- fastercsv (~> 1.5)
87
- json (~> 1.6)
88
- json_pure (~> 1.6)
89
- multi_json (~> 1.0)
90
- dm-sqlite-adapter (1.2.0)
91
- dm-do-adapter (~> 1.2.0)
92
- do_sqlite3 (~> 0.10.6)
93
- dm-timestamps (1.2.0)
94
- dm-core (~> 1.2.0)
95
- dm-transactions (1.2.0)
96
- dm-core (~> 1.2.0)
97
- dm-types (1.2.2)
98
- bcrypt-ruby (~> 3.0)
99
- dm-core (~> 1.2.0)
100
- fastercsv (~> 1.5)
101
- json (~> 1.6)
102
- multi_json (~> 1.0)
103
- stringex (~> 1.4)
104
- uuidtools (~> 2.1)
105
- dm-validations (1.2.0)
106
- dm-core (~> 1.2.0)
107
- do_jdbc (0.10.14-java)
108
- data_objects (= 0.10.14)
109
- do_sqlite3 (0.10.14)
110
- data_objects (= 0.10.14)
111
- do_sqlite3 (0.10.14-java)
112
- data_objects (= 0.10.14)
113
- do_jdbc (= 0.10.14)
114
- jdbc-sqlite3 (>= 3.5.8)
115
- erubis (2.6.6)
116
- abstract (>= 1.0.0)
117
- faraday (0.9.0)
118
- multipart-post (>= 1.2, < 3)
119
- faraday_middleware (0.9.1)
120
- faraday (>= 0.7.4, < 0.10)
121
- fastercsv (1.5.5)
122
- ffi (1.9.6)
123
- ffi (1.9.6-java)
124
- formatador (0.2.5)
125
- gherkin (2.11.6)
126
- json (>= 1.7.6)
127
- gherkin (2.11.6-java)
128
- json (>= 1.7.6)
129
- guard (1.8.3)
130
- formatador (>= 0.2.4)
131
- listen (~> 1.3)
132
- lumberjack (>= 1.0.2)
133
- pry (>= 0.9.10)
134
- thor (>= 0.14.6)
135
- guard-rspec (2.5.4)
136
- guard (>= 1.1)
137
- rspec (~> 2.11)
138
- httparty (0.13.3)
139
- json (~> 1.8)
140
- multi_xml (>= 0.5.2)
141
- httpclient (2.5.3.3)
142
- i18n (0.4.2)
143
- jdbc-sqlite3 (3.8.10.1)
144
- json (1.8.1)
145
- json (1.8.1-java)
146
- json_pure (1.8.1)
147
- listen (1.3.1)
148
- rb-fsevent (>= 0.9.3)
149
- rb-inotify (>= 0.9)
150
- rb-kqueue (>= 0.2)
151
- lumberjack (1.0.9)
152
- method_source (0.8.2)
153
- mime-types (1.25.1)
154
- mongo (1.11.1)
155
- bson (= 1.11.1)
156
- mongo_ext (0.19.3)
157
- mongo_mapper (0.12.0)
158
- activemodel (~> 3.0)
159
- activesupport (~> 3.0)
160
- plucky (~> 0.5.2)
161
- mongoid (2.2.6)
162
- activemodel (~> 3.0.0)
163
- mongo (~> 1.3)
164
- tzinfo (~> 0.3.22)
165
- mongoid-tree (0.7.0)
166
- mongoid (~> 2.0)
167
- moped (1.5.2)
168
- multi_json (1.2.0)
169
- multi_xml (0.5.5)
170
- multipart-post (2.0.0)
171
- mysql (2.9.1)
172
- mysql2 (0.3.18)
173
- neo4j-community (2.1.5)
174
- neo4j-core (3.0.8)
175
- activesupport
176
- faraday (~> 0.9.0)
177
- faraday_middleware (~> 0.9.1)
178
- httparty
179
- httpclient
180
- json
181
- neo4j-community (~> 2.1.1)
182
- net-http-persistent
183
- os
184
- zip
185
- nest (1.1.2)
186
- redis
187
- net-http-persistent (2.9.4)
188
- ohm (0.1.5)
189
- nest (~> 1.0)
190
- os (0.9.6)
191
- pg (0.18.2)
192
- plucky (0.5.2)
193
- mongo (~> 1.5)
194
- pry (0.10.1)
195
- coderay (~> 1.1.0)
196
- method_source (~> 0.8.1)
197
- slop (~> 3.4)
198
- pry (0.10.1-java)
199
- coderay (~> 1.1.0)
200
- method_source (~> 0.8.1)
201
- slop (~> 3.4)
202
- spoon (~> 0.0)
203
- rack (1.2.8)
204
- rack-mount (0.6.14)
205
- rack (>= 1.0.0)
206
- rack-test (0.5.7)
207
- rack (>= 1.0)
208
- railties (3.0.0)
209
- actionpack (= 3.0.0)
210
- activesupport (= 3.0.0)
211
- rake (>= 0.8.4)
212
- thor (~> 0.14.0)
213
- rake (11.1.2)
214
- rb-fsevent (0.9.4)
215
- rb-inotify (0.9.5)
216
- ffi (>= 0.5.0)
217
- rb-kqueue (0.2.3)
218
- ffi (>= 0.5.0)
219
- rdoc (4.1.2)
220
- json (~> 1.4)
221
- redis (3.1.0)
222
- rest-client (1.6.8)
223
- mime-types (~> 1.16)
224
- rdoc (>= 2.4.2)
225
- rspec (2.14.1)
226
- rspec-core (~> 2.14.0)
227
- rspec-expectations (~> 2.14.0)
228
- rspec-mocks (~> 2.14.0)
229
- rspec-core (2.14.8)
230
- rspec-expectations (2.14.5)
231
- diff-lcs (>= 1.1.3, < 2.0)
232
- rspec-mocks (2.14.6)
233
- rspec-rails (2.14.2)
234
- actionpack (>= 3.0)
235
- activemodel (>= 3.0)
236
- activesupport (>= 3.0)
237
- railties (>= 3.0)
238
- rspec-core (~> 2.14.0)
239
- rspec-expectations (~> 2.14.0)
240
- rspec-mocks (~> 2.14.0)
241
- sequel (3.21.0)
242
- slop (3.6.0)
243
- spoon (0.0.4)
244
- ffi
245
- sqlite3 (1.3.10)
246
- stringex (1.5.1)
247
- thor (0.14.6)
248
- tzinfo (0.3.48)
249
- uuidtools (2.1.5)
250
- zip (2.0.2)
251
-
252
- PLATFORMS
253
- java
254
- ruby
255
-
256
- DEPENDENCIES
257
- activerecord
258
- activerecord-mysql2-adapter
259
- bson_ext
260
- bundler
261
- couch_potato
262
- cucumber
263
- database_cleaner!
264
- datamapper
265
- dm-migrations
266
- dm-sqlite-adapter
267
- guard-rspec
268
- json_pure
269
- mongo_ext
270
- mongo_mapper
271
- mongoid
272
- mongoid-tree
273
- moped
274
- mysql (~> 2.9.1)
275
- mysql2
276
- neo4j-core
277
- ohm (~> 0.1.3)
278
- pg
279
- rake
280
- rspec-rails (~> 2.14.2)
281
- sequel (~> 3.21.0)
282
- sqlite3
283
- tzinfo
284
-
285
- BUNDLED WITH
286
- 1.11.2
@@ -1,7 +0,0 @@
1
- ---
2
- one:
3
- adapter: sqlite3
4
- database: "/Users/etagwerker/Projects/database_cleaner/examples/features/support/../../db/activerecord_one.db"
5
- two:
6
- adapter: sqlite3
7
- database: "/Users/etagwerker/Projects/database_cleaner/examples/features/support/../../db/activerecord_two.db"
@@ -1,8 +0,0 @@
1
- #This is an example of what database.yml *should* look like (when I wrote it)
2
- #The real database.yml is generated automatically by the active record model lib (so it can be correct)
3
- two:
4
- adapter: sqlite3
5
- database: /path/to/examples/features/support/../../db/activerecord_two.db
6
- one:
7
- adapter: sqlite3
8
- database: /path/to/examples/features/support/../../db/activerecord_one.db
@@ -1,8 +0,0 @@
1
- test:
2
- url: 'redis://localhost:6379/0'
3
-
4
- one:
5
- url: 'redis://localhost:6379/1'
6
-
7
- two:
8
- url: 'redis://localhost:6379/2'
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
@@ -1,11 +0,0 @@
1
- Feature: example
2
- In order to test DataBase Cleaner
3
- Here are some scenarios that rely on the DB being clean!
4
-
5
- Scenario: dirty the db
6
- When I create a widget
7
- Then I should see 1 widget
8
-
9
- Scenario: assume a clean db
10
- When I create a widget
11
- Then I should see 1 widget
@@ -1,23 +0,0 @@
1
- Feature: example
2
- In order to test DataBase Cleaner
3
- Here are some scenarios that rely on the DB being clean!
4
-
5
- # Background:
6
- # Given I have setup DatabaseCleaner to clean multiple databases
7
- #
8
- Scenario: dirty the db
9
- When I create a widget in one db
10
- And I create a widget in another db
11
- Then I should see 1 widget in one db
12
- And I should see 1 widget in another db
13
-
14
- Scenario: assume a clean db
15
- When I create a widget in one db
16
- Then I should see 1 widget in one db
17
- And I should see 0 widget in another db
18
-
19
- Scenario: assume a clean db
20
- When I create a widget in another db
21
- Then I should see 0 widget in one db
22
- And I should see 1 widget in another db
23
-
@@ -1,22 +0,0 @@
1
- Feature: example
2
- In order to test DataBase Cleaner
3
- Here are some scenarios that rely on the DB being clean!
4
-
5
- # Background:
6
- # Given I have setup DatabaseCleaner to clean multiple orms
7
-
8
- Scenario: dirty the db
9
- When I create a widget in one orm
10
- And I create a widget in another orm
11
- Then I should see 1 widget in one orm
12
- And I should see 1 widget in another orm
13
-
14
- Scenario: assume a clean db
15
- When I create a widget in one orm
16
- Then I should see 1 widget in one orm
17
- And I should see 0 widget in another orm
18
-
19
- Scenario: assume a clean db
20
- When I create a widget in another orm
21
- Then I should see 0 widget in one orm
22
- And I should see 1 widget in another orm
@@ -1,31 +0,0 @@
1
- Given /^I have setup database cleaner to clean multiple databases using activerecord$/ do
2
- #DatabaseCleaner
3
- # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
4
- #
5
- # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
6
- # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
7
- end
8
-
9
- When /^I create a widget using activerecord$/ do
10
- ActiveRecordWidget.create!
11
- end
12
-
13
- Then /^I should see ([\d]+) widget using activerecord$/ do |widget_count|
14
- ActiveRecordWidget.count.should == widget_count.to_i
15
- end
16
-
17
- When /^I create a widget in one db using activerecord$/ do
18
- ActiveRecordWidgetUsingDatabaseOne.create!
19
- end
20
-
21
- When /^I create a widget in another db using activerecord$/ do
22
- ActiveRecordWidgetUsingDatabaseTwo.create!
23
- end
24
-
25
- Then /^I should see ([\d]+) widget in one db using activerecord$/ do |widget_count|
26
- ActiveRecordWidgetUsingDatabaseOne.count.should == widget_count.to_i
27
- end
28
-
29
- Then /^I should see ([\d]+) widget in another db using activerecord$/ do |widget_count|
30
- ActiveRecordWidgetUsingDatabaseTwo.count.should == widget_count.to_i
31
- end
@@ -1,31 +0,0 @@
1
- Given /^I have setup database cleaner to clean multiple databases using couchpotato$/ do
2
- #DatabaseCleaner
3
- # require "#{File.dirname(__FILE__)}/../../../lib/couchpotato_models"
4
- #
5
- # DatabaseCleaner[:couchpotato, {:connection => :one} ].strategy = :truncation
6
- # DatabaseCleaner[:couchpotato, {:connection => :two} ].strategy = :truncation
7
- end
8
-
9
- When /^I create a widget using couchpotato$/ do
10
- CouchPotatoWidget.create!
11
- end
12
-
13
- Then /^I should see ([\d]+) widget using couchpotato$/ do |widget_count|
14
- CouchPotatoWidget.count.should == widget_count.to_i
15
- end
16
-
17
- When /^I create a widget in one db using couchpotato$/ do
18
- CouchPotatoWidgetUsingDatabaseOne.create!
19
- end
20
-
21
- When /^I create a widget in another db using couchpotato$/ do
22
- CouchPotatoWidgetUsingDatabaseTwo.create!
23
- end
24
-
25
- Then /^I should see ([\d]+) widget in one db using couchpotato$/ do |widget_count|
26
- CouchPotatoWidgetUsingDatabaseOne.count.should == widget_count.to_i
27
- end
28
-
29
- Then /^I should see ([\d]+) widget in another db using couchpotato$/ do |widget_count|
30
- CouchPotatoWidgetUsingDatabaseTwo.count.should == widget_count.to_i
31
- end
@@ -1,37 +0,0 @@
1
- Given /^I have setup database cleaner to clean multiple databases using datamapper$/ do
2
- #DatabaseCleaner
3
- # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
4
- #
5
- # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
6
- # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
7
- end
8
-
9
- When /^I create a widget using datamapper$/ do
10
- DataMapperWidget.create!
11
- end
12
-
13
- Then /^I should see ([\d]+) widget using datamapper$/ do |widget_count|
14
- DataMapperWidget.count.should == widget_count.to_i
15
- end
16
-
17
- When /^I create a widget in one db using datamapper$/ do
18
- begin
19
- DataMapperWidgetUsingDatabaseOne.create!
20
- rescue StandardError => e
21
- BREAK = e.backtrace
22
- debugger
23
- DataMapperWidgetUsingDatabaseOne.create!
24
- end
25
- end
26
-
27
- When /^I create a widget in another db using datamapper$/ do
28
- DataMapperWidgetUsingDatabaseTwo.create!
29
- end
30
-
31
- Then /^I should see ([\d]+) widget in one db using datamapper$/ do |widget_count|
32
- DataMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
33
- end
34
-
35
- Then /^I should see ([\d]+) widget in another db using datamapper$/ do |widget_count|
36
- DataMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
37
- end
@@ -1,23 +0,0 @@
1
- When /^I create a widget using mongoid$/ do
2
- MongoidWidget.create!( :id => rand(1000)+1000)
3
- end
4
-
5
- Then /^I should see ([\d]+) widget using mongoid$/ do |widget_count|
6
- MongoidWidget.count.should == widget_count.to_i
7
- end
8
-
9
- When /^I create a widget in one db using mongoid$/ do
10
- MongoidWidgetUsingDatabaseOne.create!
11
- end
12
-
13
- When /^I create a widget in another db using mongoid$/ do
14
- MongoidWidgetUsingDatabaseTwo.create!
15
- end
16
-
17
- Then /^I should see ([\d]+) widget in one db using mongoid$/ do |widget_count|
18
- MongoidWidgetUsingDatabaseOne.count.should == widget_count.to_i
19
- end
20
-
21
- Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
22
- MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
23
- end
@@ -1,31 +0,0 @@
1
- Given /^I have setup database cleaner to clean multiple databases using mongomapper$/ do
2
- #DatabaseCleaner
3
- # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
4
- #
5
- # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
6
- # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
7
- end
8
-
9
- When /^I create a widget using mongomapper$/ do
10
- MongoMapperWidget.create!
11
- end
12
-
13
- Then /^I should see ([\d]+) widget using mongomapper$/ do |widget_count|
14
- MongoMapperWidget.count.should == widget_count.to_i
15
- end
16
-
17
- When /^I create a widget in one db using mongomapper$/ do
18
- MongoMapperWidgetUsingDatabaseOne.create!
19
- end
20
-
21
- When /^I create a widget in another db using mongomapper$/ do
22
- MongoMapperWidgetUsingDatabaseTwo.create!
23
- end
24
-
25
- Then /^I should see ([\d]+) widget in one db using mongomapper$/ do |widget_count|
26
- MongoMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
27
- end
28
-
29
- Then /^I should see ([\d]+) widget in another db using mongomapper$/ do |widget_count|
30
- MongoMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
31
- end
@@ -1,23 +0,0 @@
1
- When /^I create a widget using neo4j$/ do
2
- Neo4jWidget.create!
3
- end
4
-
5
- Then /^I should see ([\d]+) widget using neo4j$/ do |widget_count|
6
- Neo4jWidget.count.should == widget_count.to_i
7
- end
8
-
9
- When /^I create a widget in one db using neo4j$/ do
10
- Neo4jWidgetUsingDatabaseOne.create!
11
- end
12
-
13
- When /^I create a widget in another db using neo4j$/ do
14
- Neo4jWidgetUsingDatabaseTwo.create!
15
- end
16
-
17
- Then /^I should see ([\d]+) widget in one db using neo4j$/ do |widget_count|
18
- Neo4jWidgetUsingDatabaseOne.count.should == widget_count.to_i
19
- end
20
-
21
- Then /^I should see ([\d]+) widget in another db using neo4j$/ do |widget_count|
22
- Neo4jWidgetUsingDatabaseTwo.count.should == widget_count.to_i
23
- end
@@ -1,55 +0,0 @@
1
- When /^I create a widget$/ do
2
- step "I create a widget using #{ENV['ORM'].downcase}"
3
- end
4
-
5
- Then /^I should see 1 widget$/ do
6
- step "I should see 1 widget using #{ENV['ORM'].downcase}"
7
- end
8
-
9
- When /^I create a widget in one orm$/ do
10
- step "I create a widget using #{ENV['ORM'].downcase}"
11
- end
12
-
13
- When /^I create a widget in another orm$/ do
14
- step "I create a widget using #{ENV['ANOTHER_ORM'].downcase}"
15
- end
16
-
17
- Then /^I should see 1 widget in one orm$/ do
18
- step "I should see 1 widget using #{ENV['ORM'].downcase}"
19
- end
20
-
21
- Then /^I should see 1 widget in another orm$/ do
22
- step "I should see 1 widget using #{ENV['ANOTHER_ORM'].downcase}"
23
- end
24
-
25
- Then /^I should see 0 widget in another orm$/ do
26
- step "I should see 0 widget using #{ENV['ANOTHER_ORM'].downcase}"
27
- end
28
-
29
- Then /^I should see 0 widget in one orm$/ do
30
- step "I should see 0 widget using #{ENV['ORM'].downcase}"
31
- end
32
-
33
- When /^I create a widget in one db$/ do
34
- step "I create a widget in one db using #{ENV['ORM'].downcase}"
35
- end
36
-
37
- When /^I create a widget in another db$/ do
38
- step "I create a widget in another db using #{ENV['ORM'].downcase}"
39
- end
40
-
41
- Then /^I should see 1 widget in one db$/ do
42
- step "I should see 1 widget in one db using #{ENV['ORM'].downcase}"
43
- end
44
-
45
- Then /^I should see 1 widget in another db$/ do
46
- step "I should see 1 widget in another db using #{ENV['ORM'].downcase}"
47
- end
48
-
49
- Then /^I should see 0 widget in another db$/ do
50
- step "I should see 0 widget in another db using #{ENV['ORM'].downcase}"
51
- end
52
-
53
- Then /^I should see 0 widget in one db$/ do
54
- step "I should see 0 widget in one db using #{ENV['ORM'].downcase}"
55
- end
@@ -1,61 +0,0 @@
1
- #Hilarious as it seems, this is necessary so bundle exec cucumber works for mongoid cukeage (I'm assuming mongomapper is automatically present because its a git repo)
2
- Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
3
-
4
- require 'rubygems'
5
- require 'bundler'
6
-
7
- Bundler.setup
8
- require 'rspec/expectations'
9
- #require 'ruby-debug'
10
-
11
- DB_DIR = "#{File.dirname(__FILE__)}/../../db"
12
-
13
- orm = ENV['ORM']
14
- another_orm = ENV['ANOTHER_ORM']
15
- strategy = ENV['STRATEGY']
16
- multiple_db = ENV['MULTIPLE_DBS']
17
-
18
- config = YAML::load(File.open("#{File.dirname(__FILE__)}/../../config/redis.yml"))
19
- ENV['REDIS_URL'] = config['test']['url']
20
- ENV['REDIS_URL_ONE'] = config['one']['url']
21
- ENV['REDIS_URL_TWO'] = config['two']['url']
22
-
23
- if orm && strategy
24
- $:.unshift(File.dirname(__FILE__) + '/../../../lib')
25
- require 'database_cleaner'
26
- require 'database_cleaner/cucumber'
27
- require "#{File.dirname(__FILE__)}/../../lib/#{orm.downcase}_models"
28
-
29
- if another_orm
30
- require "#{File.dirname(__FILE__)}/../../lib/#{another_orm.downcase}_models"
31
- end
32
-
33
- if multiple_db
34
- DatabaseCleaner.app_root = "#{File.dirname(__FILE__)}/../.."
35
- orm_sym = orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym
36
-
37
- case orm_sym
38
- when :mongo_mapper
39
- DatabaseCleaner[ orm_sym, {:connection => 'database_cleaner_test_one'} ].strategy = strategy.to_sym
40
- DatabaseCleaner[ orm_sym, {:connection => 'database_cleaner_test_two'} ].strategy = strategy.to_sym
41
- when :redis, :ohm
42
- DatabaseCleaner[ orm_sym, {:connection => ENV['REDIS_URL_ONE']} ].strategy = strategy.to_sym
43
- DatabaseCleaner[ orm_sym, {:connection => ENV['REDIS_URL_TWO']} ].strategy = strategy.to_sym
44
- when :active_record
45
- DatabaseCleaner[:active_record, {:model => ActiveRecordWidgetUsingDatabaseOne} ].strategy = strategy.to_sym
46
- DatabaseCleaner[:active_record, {:model => ActiveRecordWidgetUsingDatabaseTwo} ].strategy = strategy.to_sym
47
- else
48
- DatabaseCleaner[ orm_sym, {:connection => :one} ].strategy = strategy.to_sym
49
- DatabaseCleaner[ orm_sym, {:connection => :two} ].strategy = strategy.to_sym
50
- end
51
-
52
- elsif another_orm
53
- DatabaseCleaner[ orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym ].strategy = strategy.to_sym
54
- DatabaseCleaner[ another_orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym ].strategy = strategy.to_sym
55
- else
56
- DatabaseCleaner.strategy = strategy.to_sym unless strategy == "default"
57
- end
58
-
59
- else
60
- raise "Run 'ORM=ActiveRecord|DataMapper|MongoMapper|CouchPotato|Ohm|Redis [ANOTHER_ORM=...] [MULTIPLE_DBS=true] STRATEGY=transaction|truncation|default cucumber examples/features'"
61
- end