activerecord 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

Files changed (68) hide show
  1. data/CHANGELOG +250 -0
  2. data/README +17 -9
  3. data/dev-utils/eval_debugger.rb +1 -1
  4. data/install.rb +3 -1
  5. data/lib/active_record.rb +9 -2
  6. data/lib/active_record/acts/list.rb +178 -0
  7. data/lib/active_record/acts/tree.rb +44 -0
  8. data/lib/active_record/associations.rb +45 -8
  9. data/lib/active_record/associations/association_collection.rb +18 -9
  10. data/lib/active_record/associations/has_and_belongs_to_many_association.rb +14 -13
  11. data/lib/active_record/associations/has_many_association.rb +21 -12
  12. data/lib/active_record/base.rb +137 -37
  13. data/lib/active_record/callbacks.rb +30 -25
  14. data/lib/active_record/connection_adapters/abstract_adapter.rb +57 -33
  15. data/lib/active_record/connection_adapters/mysql_adapter.rb +4 -0
  16. data/lib/active_record/connection_adapters/sqlite_adapter.rb +3 -2
  17. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +298 -0
  18. data/lib/active_record/fixtures.rb +241 -147
  19. data/lib/active_record/support/class_inheritable_attributes.rb +5 -2
  20. data/lib/active_record/support/inflector.rb +13 -12
  21. data/lib/active_record/support/misc.rb +6 -0
  22. data/lib/active_record/timestamp.rb +33 -0
  23. data/lib/active_record/transactions.rb +1 -1
  24. data/lib/active_record/validations.rb +294 -16
  25. data/rakefile +3 -7
  26. data/test/abstract_unit.rb +1 -4
  27. data/test/associations_test.rb +17 -4
  28. data/test/base_test.rb +37 -5
  29. data/test/connections/native_sqlserver/connection.rb +15 -0
  30. data/test/deprecated_associations_test.rb +40 -38
  31. data/test/finder_test.rb +82 -4
  32. data/test/fixtures/accounts.yml +8 -0
  33. data/test/fixtures/company.rb +6 -0
  34. data/test/fixtures/company_in_module.rb +1 -1
  35. data/test/fixtures/db_definitions/mysql.sql +13 -0
  36. data/test/fixtures/db_definitions/postgresql.sql +13 -0
  37. data/test/fixtures/db_definitions/sqlite.sql +14 -0
  38. data/test/fixtures/db_definitions/sqlserver.sql +110 -0
  39. data/test/fixtures/db_definitions/sqlserver2.sql +4 -0
  40. data/test/fixtures/developer.rb +2 -2
  41. data/test/fixtures/developers.yml +13 -0
  42. data/test/fixtures/fixture_database.sqlite +0 -0
  43. data/test/fixtures/fixture_database_2.sqlite +0 -0
  44. data/test/fixtures/mixin.rb +17 -0
  45. data/test/fixtures/mixins.yml +14 -0
  46. data/test/fixtures/naked/csv/accounts.csv +1 -0
  47. data/test/fixtures/naked/yml/accounts.yml +1 -0
  48. data/test/fixtures/naked/yml/companies.yml +1 -0
  49. data/test/fixtures/naked/yml/courses.yml +1 -0
  50. data/test/fixtures/project.rb +6 -0
  51. data/test/fixtures/reply.rb +14 -1
  52. data/test/fixtures/topic.rb +2 -2
  53. data/test/fixtures/topics/first +1 -0
  54. data/test/fixtures_test.rb +42 -12
  55. data/test/inflector_test.rb +2 -1
  56. data/test/inheritance_test.rb +22 -12
  57. data/test/mixin_test.rb +138 -0
  58. data/test/pk_test.rb +4 -2
  59. data/test/reflection_test.rb +3 -3
  60. data/test/transactions_test.rb +15 -0
  61. data/test/validations_test.rb +229 -4
  62. metadata +24 -10
  63. data/lib/active_record/associations.rb.orig +0 -555
  64. data/test/deprecated_associations_test.rb.orig +0 -334
  65. data/test/fixtures/accounts/signals37 +0 -3
  66. data/test/fixtures/accounts/unknown +0 -2
  67. data/test/fixtures/developers/david +0 -2
  68. data/test/fixtures/developers/jamis +0 -2
data/rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10
10
  PKG_NAME = 'activerecord'
11
- PKG_VERSION = '1.1.0' + PKG_BUILD
11
+ PKG_VERSION = '1.2.0' + PKG_BUILD
12
12
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
13
 
14
14
  PKG_FILES = FileList[
@@ -62,6 +62,7 @@ Rake::RDocTask.new { |rdoc|
62
62
  desc "Publish the beta gem"
63
63
  task :pgem => [:package] do
64
64
  Rake::SshFilePublisher.new("davidhh@one.textdrive.com", "domains/rubyonrails.org/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
65
+ `ssh davidhh@one.textdrive.com './gemupdate.sh'`
65
66
  end
66
67
 
67
68
  # Publish documentation
@@ -70,11 +71,6 @@ task :pdoc => [:rdoc] do
70
71
  Rake::SshDirPublisher.new("davidhh@one.textdrive.com", "domains/rubyonrails.org/ar", "doc").upload
71
72
  end
72
73
 
73
- desc "Publish to RubyForge"
74
- task :rubyforge do
75
- Rake::RubyForgePublisher.new('activerecord', 'webster132').upload
76
- end
77
-
78
74
 
79
75
  # Create compressed packages
80
76
 
@@ -88,7 +84,7 @@ spec = Gem::Specification.new do |s|
88
84
 
89
85
  s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG" ]
90
86
  dist_dirs.each do |dir|
91
- s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "CVS" ) }
87
+ s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
92
88
  end
93
89
  s.files.delete "test/fixtures/fixture_database.sqlite"
94
90
  s.require_path = 'lib'
@@ -1,8 +1,5 @@
1
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
-
3
- # Make rubygems available for testing if possible
4
- begin require('rubygems'); rescue LoadError; end
5
- begin require('dev-utils/debug'); rescue LoadError; end
2
+ # $:.unshift(File.dirname(__FILE__) + '/fixtures')
6
3
 
7
4
  require 'test/unit'
8
5
  require 'active_record'
@@ -18,7 +18,7 @@ raise "ActiveRecord should have barked on bad collection keys" unless bad_collec
18
18
 
19
19
  class AssociationsTest < Test::Unit::TestCase
20
20
  def setup
21
- create_fixtures "accounts", "companies", "accounts", "developers", "projects", "developers_projects"
21
+ create_fixtures "accounts", "companies", "developers", "projects", "developers_projects"
22
22
  @signals37 = Firm.find(1)
23
23
  end
24
24
 
@@ -64,7 +64,7 @@ end
64
64
 
65
65
  class HasOneAssociationsTest < Test::Unit::TestCase
66
66
  def setup
67
- create_fixtures "accounts", "companies", "accounts", "developers", "projects", "developers_projects"
67
+ create_fixtures "accounts", "companies", "developers", "projects", "developers_projects"
68
68
  @signals37 = Firm.find(1)
69
69
  end
70
70
 
@@ -141,7 +141,7 @@ end
141
141
 
142
142
  class HasManyAssociationsTest < Test::Unit::TestCase
143
143
  def setup
144
- create_fixtures "accounts", "companies", "accounts", "developers", "projects", "developers_projects", "topics"
144
+ create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "topics"
145
145
  @signals37 = Firm.find(1)
146
146
  end
147
147
 
@@ -178,6 +178,11 @@ class HasManyAssociationsTest < Test::Unit::TestCase
178
178
  assert_equal 1, Firm.find_first.clients_using_sql.size
179
179
  end
180
180
 
181
+ def test_counting_using_sql
182
+ assert_equal 1, Firm.find_first.clients_using_counter_sql.size
183
+ assert_equal 0, Firm.find_first.clients_using_zero_counter_sql.size
184
+ end
185
+
181
186
  def test_find_all
182
187
  assert_equal 2, Firm.find_first.clients.find_all("type = 'Client'").length
183
188
  assert_equal 1, Firm.find_first.clients.find_all("name = 'Summit'").length
@@ -291,6 +296,14 @@ class HasManyAssociationsTest < Test::Unit::TestCase
291
296
  assert_equal 0, Client.find_all.length
292
297
  end
293
298
 
299
+ def test_three_levels_of_dependence
300
+ topic = Topic.create "title" => "neat and simple"
301
+ reply = topic.replies.create "title" => "neat and simple", "content" => "still digging it"
302
+ silly_reply = reply.silly_replies.create "title" => "neat and simple", "content" => "ain't complaining"
303
+
304
+ assert_nothing_raised { topic.destroy }
305
+ end
306
+
294
307
  def test_dependence_with_transaction_support_on_failure
295
308
  assert_equal 2, Client.find_all.length
296
309
  firm = Firm.find_first
@@ -319,7 +332,7 @@ end
319
332
 
320
333
  class BelongsToAssociationsTest < Test::Unit::TestCase
321
334
  def setup
322
- create_fixtures "accounts", "companies", "accounts", "developers", "projects", "developers_projects", "topics"
335
+ create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "topics"
323
336
  @signals37 = Firm.find(1)
324
337
  end
325
338
 
@@ -137,16 +137,28 @@ class BasicsTest < Test::Unit::TestCase
137
137
  assert_equal("Updated topic", topicReloadedAgain.title)
138
138
  end
139
139
 
140
- def test_preserving_objects
141
- assert_kind_of(
142
- Time, Topic.find(1).written_on,
143
- "The written_on attribute should be of the Time class"
144
- )
140
+ def test_preserving_date_objects
141
+ # SQL Server doesn't have a separate column type just for dates, so all are returned as time
142
+ if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter
143
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
144
+ end
145
145
 
146
146
  assert_kind_of(
147
147
  Date, Topic.find(1).last_read,
148
148
  "The last_read attribute should be of the Date class"
149
149
  )
150
+
151
+ assert_kind_of(
152
+ Time, Topic.find(1).bonus_time,
153
+ "The bonus_time attribute should be of the Time class"
154
+ )
155
+ end
156
+
157
+ def test_preserving_time_objects
158
+ assert_kind_of(
159
+ Time, Topic.find(1).written_on,
160
+ "The written_on attribute should be of the Time class"
161
+ )
150
162
  end
151
163
 
152
164
  def test_destroy
@@ -304,6 +316,7 @@ class BasicsTest < Test::Unit::TestCase
304
316
  topic = Topic.new
305
317
  assert_equal 1, topic.approved
306
318
  assert_nil topic.written_on
319
+ assert_nil topic.bonus_time
307
320
  assert_nil topic.last_read
308
321
 
309
322
  topic.save
@@ -369,6 +382,11 @@ class BasicsTest < Test::Unit::TestCase
369
382
  end
370
383
 
371
384
  def test_multiparameter_attributes_on_date
385
+ # SQL Server doesn't have a separate column type just for dates, so all are returned as time
386
+ if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter
387
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
388
+ end
389
+
372
390
  attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "24" }
373
391
  topic = Topic.find(1)
374
392
  topic.attributes = attributes
@@ -376,6 +394,11 @@ class BasicsTest < Test::Unit::TestCase
376
394
  end
377
395
 
378
396
  def test_multiparameter_attributes_on_date_with_empty_date
397
+ # SQL Server doesn't have a separate column type just for dates, so all are returned as time
398
+ if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter
399
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLServerAdapter)
400
+ end
401
+
379
402
  attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "" }
380
403
  topic = Topic.find(1)
381
404
  topic.attributes = attributes
@@ -409,6 +432,15 @@ class BasicsTest < Test::Unit::TestCase
409
432
  assert_equal Time.local(2004, 6, 24, 16, 24, 0), topic.written_on
410
433
  end
411
434
 
435
+ def test_attributes_on_dummy_time
436
+ attributes = {
437
+ "bonus_time" => "5:42:00AM"
438
+ }
439
+ topic = Topic.find(1)
440
+ topic.attributes = attributes
441
+ assert_equal Time.local(2000, 1, 1, 5, 42, 0), topic.bonus_time
442
+ end
443
+
412
444
  def test_boolean
413
445
  b_false = Booleantest.create({ "value" => false })
414
446
  false_id = b_false.id
@@ -0,0 +1,15 @@
1
+ print "Using native SQLServer\n"
2
+ require 'fixtures/course'
3
+ require 'logger'
4
+
5
+ ActiveRecord::Base.logger = Logger.new("debug.log")
6
+
7
+ ActiveRecord::Base.establish_connection(
8
+ :adapter => "sqlserver",
9
+ :dsn => "DBI:ADO:Provider=SQLOLEDB;Data Source=(local);Initial Catalog=test;User Id=sa;Password=password;"
10
+ )
11
+
12
+ Course.establish_connection(
13
+ :adapter => "sqlserver",
14
+ :dsn => "DBI:ADO:Provider=SQLOLEDB;Data Source=(local);Initial Catalog=test2;User Id=sa;Password=password;"
15
+ )
@@ -18,14 +18,14 @@ raise "ActiveRecord should have barked on bad collection keys" unless bad_collec
18
18
 
19
19
  class DeprecatedAssociationsTest < Test::Unit::TestCase
20
20
  def setup
21
- create_fixtures "accounts", "companies", "accounts", "developers", "projects", "developers_projects", "topics"
21
+ create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "topics"
22
22
  @signals37 = Firm.find(1)
23
23
  end
24
24
 
25
25
  def test_has_many_find
26
26
  assert_equal 2, Firm.find_first.clients.length
27
27
  end
28
-
28
+
29
29
  def test_has_many_orders
30
30
  assert_equal "Summit", Firm.find_first.clients.first.name
31
31
  end
@@ -37,7 +37,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
37
37
  def test_has_many_foreign_key
38
38
  assert_equal "Microsoft", Firm.find_first.clients_of_firm.first.name
39
39
  end
40
-
40
+
41
41
  def test_has_many_conditions
42
42
  assert_equal "Microsoft", Firm.find_first.clients_like_ms.first.name
43
43
  end
@@ -48,7 +48,11 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
48
48
  assert_equal 1, firm.clients_using_sql_count
49
49
  assert_equal 1, Firm.find_first.clients_using_sql_count
50
50
  end
51
-
51
+
52
+ def test_has_many_counter_sql
53
+ assert_equal 1, Firm.find_first.clients_using_counter_sql_count
54
+ end
55
+
52
56
  def test_has_many_queries
53
57
  assert Firm.find_first.has_clients?
54
58
  firm = Firm.find_first
@@ -75,7 +79,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
75
79
 
76
80
  assert_equal 2, Client.find_all.length
77
81
  end
78
-
82
+
79
83
  def test_has_one_dependence
80
84
  firm = Firm.find(1)
81
85
  assert firm.has_account?
@@ -95,7 +99,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
95
99
  assert Client.find(3).has_firm?, "Microsoft should have a firm"
96
100
  # assert !Company.find(1).has_firm?, "37signals shouldn't have a firm"
97
101
  end
98
-
102
+
99
103
  def test_belongs_to_with_different_class_name
100
104
  assert_equal Company.find(1).name, Company.find(3).firm_with_other_name.name
101
105
  assert Company.find(3).has_firm_with_other_name?, "Microsoft should have a firm"
@@ -106,12 +110,11 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
106
110
  assert Company.find(3).has_firm_with_condition?, "Microsoft should have a firm"
107
111
  end
108
112
 
109
-
110
113
  def test_belongs_to_equality
111
114
  assert Company.find(3).firm?(Company.find(1)), "Microsoft should have 37signals as firm"
112
115
  assert_raises(RuntimeError) { !Company.find(3).firm?(Company.find(3)) } # "Summit shouldn't have itself as firm"
113
116
  end
114
-
117
+
115
118
  def test_has_one
116
119
  assert @signals37.account?(Account.find(1))
117
120
  assert_equal Account.find(1).credit_limit, @signals37.account.credit_limit
@@ -128,12 +131,12 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
128
131
  @signals37.destroy
129
132
  assert_equal 1, Account.find_all.length
130
133
  end
131
-
134
+
132
135
  def test_find_in
133
136
  assert_equal Client.find(2).name, @signals37.find_in_clients(2).name
134
137
  assert_raises(ActiveRecord::RecordNotFound) { @signals37.find_in_clients(6) }
135
138
  end
136
-
139
+
137
140
  def test_force_reload
138
141
  firm = Firm.new
139
142
  firm.save
@@ -141,7 +144,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
141
144
  assert firm.clients.empty?, "New firm shouldn't have client objects"
142
145
  assert !firm.has_clients?, "New firm shouldn't have clients"
143
146
  assert_equal 0, firm.clients_count, "New firm should have 0 clients"
144
-
147
+
145
148
  client = Client.new("firm_id" => firm.id)
146
149
  client.save
147
150
 
@@ -153,7 +156,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
153
156
  assert firm.has_clients?(true), "New firm should have reloaded with a have-clients response"
154
157
  assert_equal 1, firm.clients_count(true), "New firm should have reloaded clients count"
155
158
  end
156
-
159
+
157
160
  def test_included_in_collection
158
161
  assert @signals37.clients.include?(Client.find(2))
159
162
  end
@@ -167,35 +170,35 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
167
170
  assert new_client.firm?(@signals37)
168
171
  assert_equal 2, @signals37.clients_of_firm_count(true)
169
172
  end
170
-
173
+
171
174
  def test_create_in_collection
172
175
  assert_equal @signals37.create_in_clients_of_firm("name" => "Another Client"), @signals37.clients_of_firm(true).last
173
176
  end
174
-
177
+
175
178
  def test_succesful_build_association
176
179
  firm = Firm.new("name" => "GlobalMegaCorp")
177
180
  firm.save
178
-
181
+
179
182
  account = firm.build_account("credit_limit" => 1000)
180
183
  assert account.save
181
184
  assert_equal account, firm.account
182
185
  end
183
-
186
+
184
187
  def test_failing_build_association
185
188
  firm = Firm.new("name" => "GlobalMegaCorp")
186
189
  firm.save
187
-
190
+
188
191
  account = firm.build_account
189
192
  assert !account.save
190
193
  assert_equal "can't be empty", account.errors.on("credit_limit")
191
194
  end
192
-
195
+
193
196
  def test_create_association
194
197
  firm = Firm.new("name" => "GlobalMegaCorp")
195
198
  firm.save
196
199
  assert_equal firm.create_account("credit_limit" => 1000), firm.account
197
200
  end
198
-
201
+
199
202
  def test_has_and_belongs_to_many
200
203
  david = Developer.find(1)
201
204
  assert david.has_projects?
@@ -212,15 +215,15 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
212
215
  active_record = Project.find(1)
213
216
 
214
217
  david.remove_projects(active_record)
215
-
218
+
216
219
  assert_equal 1, david.projects_count
217
- assert_equal 1, active_record.developers_count
220
+ assert_equal 1, active_record.developers_count
218
221
  end
219
222
 
220
223
  def test_has_and_belongs_to_many_zero
221
224
  david = Developer.find(1)
222
225
  david.remove_projects(Project.find_all)
223
-
226
+
224
227
  assert_equal 0, david.projects_count
225
228
  assert !david.has_projects?
226
229
  end
@@ -230,9 +233,9 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
230
233
  action_controller = Project.find(2)
231
234
 
232
235
  jamis.add_projects(action_controller)
233
-
236
+
234
237
  assert_equal 2, jamis.projects_count
235
- assert_equal 2, action_controller.developers_count
238
+ assert_equal 2, action_controller.developers_count
236
239
  end
237
240
 
238
241
  def test_has_and_belongs_to_many_adding_from_the_project
@@ -240,19 +243,19 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
240
243
  action_controller = Project.find(2)
241
244
 
242
245
  action_controller.add_developers(jamis)
243
-
246
+
244
247
  assert_equal 2, jamis.projects_count
245
248
  assert_equal 2, action_controller.developers_count
246
249
  end
247
-
250
+
248
251
  def test_has_and_belongs_to_many_adding_a_collection
249
252
  aridridel = Developer.new("name" => "Aridridel")
250
253
  aridridel.save
251
-
254
+
252
255
  aridridel.add_projects([ Project.find(1), Project.find(2) ])
253
256
  assert_equal 2, aridridel.projects_count
254
257
  end
255
-
258
+
256
259
  def test_belongs_to_counter
257
260
  topic = Topic.create("title" => "Apple", "content" => "hello world")
258
261
  assert_equal 0, topic.send(:read_attribute, "replies_count"), "No replies yet"
@@ -263,14 +266,14 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
263
266
  reply.destroy
264
267
  assert_equal 0, Topic.find(topic.id).send(:read_attribute, "replies_count"), "First reply deleted"
265
268
  end
266
-
269
+
267
270
  def test_natural_assignment_of_has_one
268
271
  apple = Firm.create("name" => "Apple")
269
272
  citibank = Account.create("credit_limit" => 10)
270
273
  apple.account = citibank
271
274
  assert_equal apple.id, citibank.firm_id
272
275
  end
273
-
276
+
274
277
  def test_natural_assignment_of_belongs_to
275
278
  apple = Firm.create("name" => "Apple")
276
279
  citibank = Account.create("credit_limit" => 10)
@@ -280,7 +283,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
280
283
 
281
284
  def test_natural_assignment_of_has_many
282
285
  apple = Firm.create("name" => "Apple")
283
- natural = Client.new("name" => "Natural Company")
286
+ natural = Client.create("name" => "Natural Company")
284
287
  apple.clients << natural
285
288
  assert_equal apple.id, natural.firm_id
286
289
  assert_equal Client.find(natural.id), Firm.find(apple.id).clients.find { |c| c.id == natural.id }
@@ -288,15 +291,14 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
288
291
  assert_nil Firm.find(apple.id).clients.find { |c| c.id == natural.id }
289
292
  end
290
293
 
291
-
292
294
  def test_natural_adding_of_has_and_belongs_to_many
293
295
  rails = Project.create("name" => "Rails")
294
296
  ap = Project.create("name" => "Action Pack")
295
297
  john = Developer.create("name" => "John")
296
298
  mike = Developer.create("name" => "Mike")
297
- rails.developers << john
298
- rails.developers << mike
299
-
299
+ rails.developers << john
300
+ rails.developers << mike
301
+
300
302
  assert_equal Developer.find(john.id), Project.find(rails.id).developers.find { |d| d.id == john.id }
301
303
  assert_equal Developer.find(mike.id), Project.find(rails.id).developers.find { |d| d.id == mike.id }
302
304
  assert_equal Project.find(rails.id), Developer.find(mike.id).projects.find { |p| p.id == rails.id }
@@ -304,10 +306,10 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
304
306
  ap.developers << john
305
307
  assert_equal Developer.find(john.id), Project.find(ap.id).developers.find { |d| d.id == john.id }
306
308
  assert_equal Project.find(ap.id), Developer.find(john.id).projects.find { |p| p.id == ap.id }
307
-
309
+
308
310
  ap.developers.delete john
309
311
  assert_nil Project.find(ap.id).developers.find { |d| d.id == john.id }
310
- assert_nil Developer.find(john.id).projects.find { |p| p.id == ap.id }
312
+ assert_nil Developer.find(john.id).projects.find { |p| p.id == ap.id }
311
313
  end
312
314
 
313
315
  def test_storing_in_pstore
@@ -332,4 +334,4 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase
332
334
  assert_equal 2, Firm.find_first.find_all_in_clients("type = 'Client'").length
333
335
  assert_equal 1, Firm.find_first.find_all_in_clients("name = 'Summit'").length
334
336
  end
335
- end
337
+ end