database_cleaner 0.5.2 → 0.6.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Gemfile.lock +145 -0
  2. data/History.txt +24 -1
  3. data/README.textile +48 -0
  4. data/Rakefile +4 -0
  5. data/TODO +3 -0
  6. data/VERSION.yml +3 -2
  7. data/examples/Gemfile +46 -0
  8. data/examples/Gemfile.lock +145 -0
  9. data/examples/config/database.yml +7 -0
  10. data/examples/config/database.yml.example +8 -0
  11. data/examples/db/activerecord_one.db +0 -0
  12. data/examples/db/activerecord_two.db +0 -0
  13. data/examples/db/datamapper_default.db +0 -0
  14. data/examples/db/datamapper_one.db +0 -0
  15. data/examples/db/datamapper_two.db +0 -0
  16. data/examples/db/sqlite_databases_go_here +0 -0
  17. data/examples/features/example_multiple_db.feature +23 -0
  18. data/examples/features/example_multiple_orm.feature +22 -0
  19. data/examples/features/step_definitions/activerecord_steps.rb +31 -0
  20. data/examples/features/step_definitions/couchpotato_steps.rb +31 -0
  21. data/examples/features/step_definitions/datamapper_steps.rb +37 -0
  22. data/examples/features/step_definitions/mongoid_steps.rb +23 -0
  23. data/examples/features/step_definitions/mongomapper_steps.rb +31 -0
  24. data/examples/features/step_definitions/translation_steps.rb +55 -0
  25. data/examples/features/support/env.rb +49 -10
  26. data/examples/lib/activerecord_models.rb +34 -5
  27. data/examples/lib/couchpotato_models.rb +46 -6
  28. data/examples/lib/datamapper_models.rb +37 -3
  29. data/examples/lib/mongoid_models.rb +28 -2
  30. data/examples/lib/mongomapper_models.rb +35 -1
  31. data/features/cleaning_multiple_dbs.feature +20 -0
  32. data/features/cleaning_multiple_orms.feature +29 -0
  33. data/features/step_definitions/database_cleaner_steps.rb +20 -13
  34. data/features/support/feature_runner.rb +39 -0
  35. data/lib/database_cleaner/active_record/base.rb +46 -0
  36. data/lib/database_cleaner/active_record/transaction.rb +10 -10
  37. data/lib/database_cleaner/active_record/truncation.rb +17 -7
  38. data/lib/database_cleaner/base.rb +129 -0
  39. data/lib/database_cleaner/configuration.rb +45 -97
  40. data/lib/database_cleaner/couch_potato/base.rb +7 -0
  41. data/lib/database_cleaner/couch_potato/truncation.rb +4 -2
  42. data/lib/database_cleaner/cucumber.rb +0 -1
  43. data/lib/database_cleaner/data_mapper/base.rb +21 -0
  44. data/lib/database_cleaner/data_mapper/transaction.rb +10 -5
  45. data/lib/database_cleaner/data_mapper/truncation.rb +52 -19
  46. data/lib/database_cleaner/generic/base.rb +23 -0
  47. data/lib/database_cleaner/generic/truncation.rb +43 -0
  48. data/lib/database_cleaner/mongo_mapper/base.rb +20 -0
  49. data/lib/database_cleaner/mongo_mapper/truncation.rb +9 -3
  50. data/lib/database_cleaner/mongoid/base.rb +20 -0
  51. data/lib/database_cleaner/mongoid/truncation.rb +9 -5
  52. data/spec/database_cleaner/active_record/base_spec.rb +130 -0
  53. data/spec/database_cleaner/active_record/truncation_spec.rb +19 -18
  54. data/spec/database_cleaner/base_spec.rb +441 -0
  55. data/spec/database_cleaner/configuration_spec.rb +255 -68
  56. data/spec/database_cleaner/couch_potato/truncation_spec.rb +4 -3
  57. data/spec/database_cleaner/data_mapper/base_spec.rb +30 -0
  58. data/spec/database_cleaner/data_mapper/transaction_spec.rb +23 -0
  59. data/spec/database_cleaner/data_mapper/truncation_spec.rb +11 -0
  60. data/spec/database_cleaner/generic/base_spec.rb +22 -0
  61. data/spec/database_cleaner/generic/truncation_spec.rb +68 -0
  62. data/spec/database_cleaner/mongo_mapper/base_spec.rb +33 -0
  63. data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +8 -0
  64. data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +11 -18
  65. data/spec/database_cleaner/shared_strategy_spec.rb +13 -0
  66. data/spec/rcov.opts +1 -0
  67. data/spec/spec.opts +1 -0
  68. data/spec/spec_helper.rb +10 -3
  69. metadata +76 -8
  70. data/examples/features/step_definitions/example_steps.rb +0 -8
  71. data/lib/database_cleaner/truncation_base.rb +0 -41
@@ -1,107 +1,294 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'database_cleaner/active_record/transaction'
3
- require 'database_cleaner/data_mapper/transaction'
4
2
 
3
+ module DatabaseCleaner
4
+ class << self
5
+ def reset
6
+ @connections = nil
7
+ end
8
+
9
+ def connections_stub!(array)
10
+ @connections = array
11
+ end
12
+ end
13
+ end
14
+
15
+ describe ::DatabaseCleaner do
16
+ before(:each) { ::DatabaseCleaner.reset }
17
+
18
+ context "orm specification" do
19
+ it "should not accept unrecognised orms" do
20
+ expect { ::DatabaseCleaner[nil] }.should raise_error(::DatabaseCleaner::NoORMDetected)
21
+ end
5
22
 
6
- describe DatabaseCleaner do
23
+ it "should accept :active_record" do
24
+ cleaner = ::DatabaseCleaner[:active_record]
25
+ cleaner.should be_a(::DatabaseCleaner::Base)
26
+ cleaner.orm.should == :active_record
27
+ ::DatabaseCleaner.connections.size.should == 1
28
+ end
29
+
30
+ it "should accept :data_mapper" do
31
+ cleaner = ::DatabaseCleaner[:data_mapper]
32
+ cleaner.should be_a(::DatabaseCleaner::Base)
33
+ cleaner.orm.should == :data_mapper
34
+ ::DatabaseCleaner.connections.size.should == 1
35
+ end
36
+
37
+ it "should accept :mongo_mapper" do
38
+ cleaner = ::DatabaseCleaner[:mongo_mapper]
39
+ cleaner.should be_a(::DatabaseCleaner::Base)
40
+ cleaner.orm.should == :mongo_mapper
41
+ ::DatabaseCleaner.connections.size.should == 1
42
+ end
7
43
 
8
- # These examples muck around with the constants for autodetection so we need to clean up....
9
- before(:all) do
10
- TempAR = ActiveRecord unless defined?(TempAR)
11
- TempMM = MongoMapper unless defined?(TempMM)
12
- TempMI = Mongoid unless defined?(TempMI)
13
- Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
14
- Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
15
- # need to add one for each ORM that we load in the spec helper...
44
+ it "should accept :couch_potato" do
45
+ cleaner = ::DatabaseCleaner[:couch_potato]
46
+ cleaner.should be_a(::DatabaseCleaner::Base)
47
+ cleaner.orm.should == :couch_potato
48
+ ::DatabaseCleaner.connections.size.should == 1
49
+ end
16
50
  end
17
- after(:all) do
18
- Object.send(:remove_const, 'ActiveRecord') if defined?(::ActiveRecord) #want to make sure we have the real one...
19
- ActiveRecord = TempAR
20
- MongoMapper = TempMM
21
- Mongoid = TempMI
51
+
52
+ it "should accept multiple orm's" do
53
+ ::DatabaseCleaner[:couch_potato]
54
+ ::DatabaseCleaner[:data_mapper]
55
+ ::DatabaseCleaner.connections.size.should == 2
56
+ ::DatabaseCleaner.connections[0].orm.should == :couch_potato
57
+ ::DatabaseCleaner.connections[1].orm.should == :data_mapper
22
58
  end
23
59
 
24
- before(:each) do
25
- DatabaseCleaner::ActiveRecord::Transaction.stub!(:new).and_return(@strategy = mock('strategy'))
26
- Object.const_set('ActiveRecord', "just mocking out the constant here...") unless defined?(::ActiveRecord)
27
- DatabaseCleaner.strategy = nil
28
- DatabaseCleaner.orm = nil
29
- end
60
+ context "connection/db specification" do
61
+ it "should accept a connection parameter and store it" do
62
+ cleaner = ::DatabaseCleaner[:active_record, {:connection => :first_connection}]
63
+ cleaner.should be_a(::DatabaseCleaner::Base)
64
+ cleaner.orm.should == :active_record
65
+ cleaner.db.should == :first_connection
66
+ end
67
+
68
+ it "should accept multiple connections for a single orm" do
69
+ ::DatabaseCleaner[:data_mapper,{:connection => :first_db}]
70
+ ::DatabaseCleaner[:data_mapper,{:connection => :second_db}]
71
+ ::DatabaseCleaner.connections.size.should == 2
72
+ ::DatabaseCleaner.connections[0].orm.should == :data_mapper
73
+ ::DatabaseCleaner.connections[0].db.should == :first_db
74
+ ::DatabaseCleaner.connections[1].orm.should == :data_mapper
75
+ ::DatabaseCleaner.connections[1].db.should == :second_db
76
+ end
77
+
78
+ it "should accept multiple connections and multiple orms" do
79
+ ::DatabaseCleaner[:data_mapper, {:connection => :first_db} ]
80
+ ::DatabaseCleaner[:active_record,{:connection => :second_db}]
81
+ ::DatabaseCleaner[:active_record,{:connection => :first_db} ]
82
+ ::DatabaseCleaner[:data_mapper, {:connection => :second_db}]
83
+
84
+ ::DatabaseCleaner.connections.size.should == 4
85
+
86
+ ::DatabaseCleaner.connections[0].orm.should == :data_mapper
87
+ ::DatabaseCleaner.connections[0].db.should == :first_db
88
+
89
+ ::DatabaseCleaner.connections[1].orm.should == :active_record
90
+ ::DatabaseCleaner.connections[1].db.should == :second_db
30
91
 
31
- describe ".create_strategy" do
32
- it "should initialize and return the appropirate strategy" do
33
- DatabaseCleaner::ActiveRecord::Transaction.should_receive(:new).with('options' => 'hash')
34
- result = DatabaseCleaner.create_strategy(:transaction, {'options' => 'hash'})
35
- result.should == @strategy
92
+ ::DatabaseCleaner.connections[2].orm.should == :active_record
93
+ ::DatabaseCleaner.connections[2].db.should == :first_db
94
+
95
+ ::DatabaseCleaner.connections[3].orm.should == :data_mapper
96
+ ::DatabaseCleaner.connections[3].db.should == :second_db
36
97
  end
37
98
  end
38
99
 
39
- describe ".clean_with" do
40
- it "should initialize the appropirate strategy and clean with it" do
41
- DatabaseCleaner::ActiveRecord::Transaction.should_receive(:new).with('options' => 'hash')
42
- @strategy.should_receive(:clean)
43
- DatabaseCleaner.clean_with(:transaction, 'options' => 'hash')
100
+ context "connection/db retrieval" do
101
+ it "should retrieve a db rather than create a new one" do
102
+ pending
103
+ connection = ::DatabaseCleaner[:active_record].strategy = :truncation
104
+ ::DatabaseCleaner[:active_record].should == connection
44
105
  end
45
106
  end
46
107
 
47
- describe ".strategy=" do
48
- it "should initialize the appropirate strategy based on the ORM adapter detected" do
49
- DatabaseCleaner::ActiveRecord::Transaction.should_receive(:new).with('options' => 'hash')
50
- DatabaseCleaner.strategy = :transaction, {'options' => 'hash'}
108
+ context "class methods" do
109
+ subject { ::DatabaseCleaner }
110
+
111
+ its(:connections) { should respond_to(:each) }
51
112
 
52
- Object.send(:remove_const, 'ActiveRecord')
53
- Object.const_set('DataMapper', "just mocking out the constant here...")
54
- DatabaseCleaner.orm = nil
113
+ it "should give me a default (autodetection) databasecleaner by default" do
114
+ cleaner = mock("cleaner").as_null_object
115
+ ::DatabaseCleaner::Base.should_receive(:new).with().and_return(cleaner)
55
116
 
56
- DatabaseCleaner::DataMapper::Transaction.should_receive(:new).with(no_args)
57
- DatabaseCleaner.strategy = :transaction
117
+ ::DatabaseCleaner.connections.should have(1).items
118
+ ::DatabaseCleaner.connections.first.should == cleaner
58
119
  end
120
+ end
59
121
 
60
- it "should raise an error when no ORM is detected" do
61
- Object.send(:remove_const, 'ActiveRecord') if defined?(::ActiveRecord)
62
- Object.send(:remove_const, 'DataMapper') if defined?(::DataMapper)
63
- Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
122
+ context "single orm single connection" do
123
+ let(:connection) { ::DatabaseCleaner.connections.first }
64
124
 
65
- running { DatabaseCleaner.strategy = :transaction }.should raise_error(DatabaseCleaner::NoORMDetected)
125
+ it "should proxy strategy=" do
126
+ stratagum = mock("stratagum")
127
+ connection.should_receive(:strategy=).with(stratagum)
128
+ ::DatabaseCleaner.strategy = stratagum
66
129
  end
67
130
 
68
- it "should use the strategy version of the ORM specified with #orm=" do
69
- DatabaseCleaner.orm = 'data_mapper'
70
- DatabaseCleaner::DataMapper::Transaction.should_receive(:new)
131
+ it "should proxy orm=" do
132
+ orm = mock("orm")
133
+ connection.should_receive(:orm=).with(orm)
134
+ ::DatabaseCleaner.orm = orm
135
+ end
71
136
 
72
- DatabaseCleaner.strategy = :transaction
137
+ it "should proxy start" do
138
+ connection.should_receive(:start)
139
+ ::DatabaseCleaner.start
73
140
  end
74
141
 
75
- it "should raise an error when multiple args is passed in and the first is not a symbol" do
76
- running { DatabaseCleaner.strategy=Object.new, {:foo => 'bar'} }.should raise_error(ArgumentError)
142
+ it "should proxy clean" do
143
+ connection.should_receive(:clean)
144
+ ::DatabaseCleaner.clean
77
145
  end
78
146
 
79
- it "should raise an error when the specified strategy is not found" do
80
- running { DatabaseCleaner.strategy = :foo }.should raise_error(DatabaseCleaner::UnknownStrategySpecified)
147
+ it "should proxy clean_with" do
148
+ stratagem = mock("stratgem")
149
+ connection.should_receive(:clean_with).with(stratagem)
150
+ ::DatabaseCleaner.clean_with stratagem
81
151
  end
152
+ end
153
+
154
+ context "multiple connections" do
155
+
156
+ #these are relativly simple, all we need to do is make sure all connections are cleaned/started/cleaned_with appropriatly.
157
+ context "simple proxy methods" do
158
+
159
+ let(:active_record) { mock("active_mock") }
160
+ let(:data_mapper) { mock("data_mock") }
161
+
162
+ before(:each) do
163
+ ::DatabaseCleaner.stub!(:connections).and_return([active_record,data_mapper])
164
+ end
165
+
166
+ it "should proxy orm to all connections" do
167
+ active_record.should_receive(:orm=)
168
+ data_mapper.should_receive(:orm=)
169
+
170
+ ::DatabaseCleaner.orm = mock("orm")
171
+ end
172
+
173
+ it "should proxy start to all connections" do
174
+ active_record.should_receive(:start)
175
+ data_mapper.should_receive(:start)
176
+
177
+ ::DatabaseCleaner.start
178
+ end
179
+
180
+ it "should proxy clean to all connections" do
181
+ active_record.should_receive(:clean)
182
+ data_mapper.should_receive(:clean)
183
+
184
+ ::DatabaseCleaner.clean
185
+ end
186
+
187
+ it "should proxy clean_with to all connections" do
188
+ stratagem = mock("stratgem")
189
+ active_record.should_receive(:clean_with).with(stratagem)
190
+ data_mapper.should_receive(:clean_with).with(stratagem)
82
191
 
83
- it "should allow any object to be set as the strategy" do
84
- mock_strategy = mock('strategy')
85
- running { DatabaseCleaner.strategy = mock_strategy }.should_not raise_error
192
+ ::DatabaseCleaner.clean_with stratagem
193
+ end
86
194
  end
87
195
 
88
- end
196
+ # ah now we have some difficulty, we mustn't allow duplicate connections to exist, but they could
197
+ # plausably want to force orm/strategy change on two sets of orm that differ only on db
198
+ context "multiple orm proxy methods" do
199
+
200
+ it "should proxy orm to all connections and remove duplicate connections" do
201
+ active_record_1 = mock("active_mock_on_db_one").as_null_object
202
+ active_record_2 = mock("active_mock_on_db_two").as_null_object
203
+ data_mapper_1 = mock("data_mock_on_db_one").as_null_object
204
+
205
+ ::DatabaseCleaner.connections_stub! [active_record_1,active_record_2,data_mapper_1]
206
+
207
+ active_record_1.should_receive(:orm=).with(:data_mapper)
208
+ active_record_2.should_receive(:orm=).with(:data_mapper)
209
+ data_mapper_1.should_receive(:orm=).with(:data_mapper)
210
+
211
+ active_record_1.should_receive(:==).with(data_mapper_1).and_return(true)
212
+
213
+ ::DatabaseCleaner.connections.size.should == 3
214
+ ::DatabaseCleaner.orm = :data_mapper
215
+ ::DatabaseCleaner.connections.size.should == 2
216
+ end
89
217
 
218
+ it "should proxy strategy to all connections and remove duplicate connections" do
219
+ active_record_1 = mock("active_mock_strategy_one").as_null_object
220
+ active_record_2 = mock("active_mock_strategy_two").as_null_object
221
+ strategy = mock("strategy")
90
222
 
91
- %w[start clean].each do |strategy_method|
92
- describe ".#{strategy_method}" do
93
- it "should be delgated to the strategy set with strategy=" do
94
- DatabaseCleaner.strategy = :transaction
223
+ ::DatabaseCleaner.connections_stub! [active_record_1,active_record_2]
95
224
 
96
- @strategy.should_receive(strategy_method)
225
+ active_record_1.should_receive(:strategy=).with(strategy)
226
+ active_record_2.should_receive(:strategy=).with(strategy)
97
227
 
98
- DatabaseCleaner.send(strategy_method)
99
- end
228
+ active_record_1.should_receive(:==).with(active_record_2).and_return(true)
100
229
 
101
- it "should raise en error when no strategy has been set" do
102
- running { DatabaseCleaner.send(strategy_method) }.should raise_error(DatabaseCleaner::NoStrategySetError)
103
- end
230
+ ::DatabaseCleaner.connections.size.should == 2
231
+ ::DatabaseCleaner.strategy = strategy
232
+ ::DatabaseCleaner.connections.size.should == 1
104
233
  end
105
234
  end
235
+ end
236
+
237
+ describe "remove_duplicates" do
238
+ it "should remove duplicates if they are identical" do
239
+ orm = mock("orm")
240
+ connection = mock("a datamapper connection", :orm => orm )
241
+
242
+ ::DatabaseCleaner.connections_stub! [connection,connection,connection]
243
+
244
+ ::DatabaseCleaner.remove_duplicates
245
+ ::DatabaseCleaner.connections.size.should == 1
246
+ end
247
+ end
248
+
249
+ describe "app_root" do
250
+ it "should default to Dir.pwd" do
251
+ DatabaseCleaner.app_root.should == Dir.pwd
252
+ end
106
253
 
254
+ it "should store specific paths" do
255
+ DatabaseCleaner.app_root = '/path/to'
256
+ DatabaseCleaner.app_root.should == '/path/to'
257
+ end
258
+ end
259
+
260
+ describe "orm_module" do
261
+ subject { ::DatabaseCleaner }
262
+
263
+ it "should return DatabaseCleaner::ActiveRecord for :active_record" do
264
+ ::DatabaseCleaner::ActiveRecord = mock("ar module") unless defined? ::DatabaseCleaner::ActiveRecord
265
+ subject.orm_module(:active_record).should == DatabaseCleaner::ActiveRecord
266
+ end
267
+
268
+ it "should return DatabaseCleaner::DataMapper for :data_mapper" do
269
+ ::DatabaseCleaner::DataMapper = mock("dm module") unless defined? ::DatabaseCleaner::DataMapper
270
+ subject.orm_module(:data_mapper).should == DatabaseCleaner::DataMapper
271
+ end
272
+
273
+ it "should return DatabaseCleaner::MongoMapper for :mongo_mapper" do
274
+ ::DatabaseCleaner::MongoMapper = mock("mm module") unless defined? ::DatabaseCleaner::MongoMapper
275
+ subject.orm_module(:mongo_mapper).should == DatabaseCleaner::MongoMapper
276
+ end
277
+
278
+ it "should return DatabaseCleaner::Mongoid for :mongoid" do
279
+ ::DatabaseCleaner::Mongoid = mock("mongoid module") unless defined? ::DatabaseCleaner::Mongoid
280
+ subject.orm_module(:mongoid).should == DatabaseCleaner::Mongoid
281
+ end
282
+
283
+ it "should return DatabaseCleaner::Mongo for :mongo" do
284
+ ::DatabaseCleaner::Mongo = mock("mongo module") unless defined? ::DatabaseCleaner::Mongo
285
+ subject.orm_module(:mongo).should == DatabaseCleaner::Mongo
286
+ end
287
+
288
+ it "should return DatabaseCleaner::CouchPotato for :couch_potato" do
289
+ ::DatabaseCleaner::CouchPotato = mock("cp module") unless defined? ::DatabaseCleaner::CouchPotato
290
+ subject.orm_module(:couch_potato).should == DatabaseCleaner::CouchPotato
291
+ end
292
+
293
+ end
107
294
  end
@@ -6,13 +6,14 @@ module DatabaseCleaner
6
6
  module CouchPotato
7
7
 
8
8
  describe Truncation do
9
+ let(:database) { mock('database') }
10
+
9
11
  before(:each) do
10
- @database = mock('database')
11
- ::CouchPotato.stub!(:couchrest_database).and_return(@database)
12
+ ::CouchPotato.stub!(:couchrest_database).and_return(database)
12
13
  end
13
14
 
14
15
  it "should re-create the database" do
15
- @database.should_receive(:recreate!)
16
+ database.should_receive(:recreate!)
16
17
 
17
18
  Truncation.new.clean
18
19
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'database_cleaner/data_mapper/base'
3
+ require 'database_cleaner/shared_strategy_spec'
4
+
5
+ module DatabaseCleaner
6
+ describe DataMapper do
7
+ it { should respond_to(:available_strategies) }
8
+ end
9
+
10
+ module DataMapper
11
+ class ExampleStrategy
12
+ include ::DatabaseCleaner::DataMapper::Base
13
+ end
14
+
15
+ describe ExampleStrategy do
16
+ it_should_behave_like "a generic strategy"
17
+ it { should respond_to(:db) }
18
+ it { should respond_to(:db=) }
19
+
20
+ it "should store my desired db" do
21
+ subject.db = :my_db
22
+ subject.db.should == :my_db
23
+ end
24
+
25
+ it "should default to :default" do
26
+ subject.db.should == :default
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'database_cleaner/data_mapper/transaction'
3
+ require 'database_cleaner/shared_strategy_spec'
4
+ #require 'data_mapper'
5
+
6
+ module DatabaseCleaner
7
+ module DataMapper
8
+
9
+ describe Transaction do
10
+ it_should_behave_like "a generic strategy"
11
+ it_should_behave_like "a generic transaction strategy"
12
+
13
+ describe "start" do
14
+ it "should start a transaction"
15
+ end
16
+
17
+ describe "clean" do
18
+ it "should finish a transaction"
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ require 'database_cleaner/data_mapper/truncation'
2
+ require 'database_cleaner/shared_strategy_spec'
3
+
4
+ module DatabaseCleaner
5
+ module DataMapper
6
+ describe Truncation do
7
+ it_should_behave_like "a generic strategy"
8
+ it_should_behave_like "a generic truncation strategy"
9
+ end
10
+ end
11
+ end