composite_primary_keys 7.0.13 → 7.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +615 -608
  3. data/lib/composite_primary_keys.rb +110 -110
  4. data/lib/composite_primary_keys/associations/association.rb +23 -23
  5. data/lib/composite_primary_keys/associations/association_scope.rb +77 -77
  6. data/lib/composite_primary_keys/associations/has_and_belongs_to_many_association.rb +59 -59
  7. data/lib/composite_primary_keys/associations/has_many_association.rb +56 -56
  8. data/lib/composite_primary_keys/associations/join_dependency.rb +89 -89
  9. data/lib/composite_primary_keys/associations/join_dependency/join_part.rb +38 -38
  10. data/lib/composite_primary_keys/associations/preloader/association.rb +78 -78
  11. data/lib/composite_primary_keys/associations/preloader/has_and_belongs_to_many.rb +46 -46
  12. data/lib/composite_primary_keys/attribute_methods/dirty.rb +26 -26
  13. data/lib/composite_primary_keys/attribute_methods/read.rb +34 -34
  14. data/lib/composite_primary_keys/attribute_methods/write.rb +36 -36
  15. data/lib/composite_primary_keys/base.rb +0 -6
  16. data/lib/composite_primary_keys/composite_arrays.rb +30 -30
  17. data/lib/composite_primary_keys/connection_adapters/abstract/connection_specification_changes.rb +4 -2
  18. data/lib/composite_primary_keys/connection_adapters/sqlserver_adapter.rb +17 -0
  19. data/lib/composite_primary_keys/core.rb +47 -47
  20. data/lib/composite_primary_keys/persistence.rb +60 -60
  21. data/lib/composite_primary_keys/relation.rb +56 -56
  22. data/lib/composite_primary_keys/relation/calculations.rb +75 -65
  23. data/lib/composite_primary_keys/relation/finder_methods.rb +196 -196
  24. data/lib/composite_primary_keys/sanitization.rb +52 -52
  25. data/lib/composite_primary_keys/validations/uniqueness.rb +37 -39
  26. data/lib/composite_primary_keys/version.rb +8 -8
  27. data/tasks/databases/sqlserver.rake +40 -27
  28. data/test/connections/databases.example.yml +18 -18
  29. data/test/connections/native_sqlserver/connection.rb +14 -11
  30. data/test/fixtures/db_definitions/mysql.sql +208 -208
  31. data/test/fixtures/db_definitions/postgresql.sql +210 -210
  32. data/test/fixtures/db_definitions/sqlite.sql +197 -197
  33. data/test/fixtures/db_definitions/sqlserver.drop.sql +94 -91
  34. data/test/fixtures/db_definitions/sqlserver.sql +232 -226
  35. data/test/fixtures/employee.rb +5 -5
  36. data/test/test_associations.rb +275 -275
  37. data/test/test_attributes.rb +60 -60
  38. data/test/test_create.rb +112 -112
  39. data/test/test_delete.rb +152 -148
  40. data/test/test_delete_all.rb +21 -21
  41. data/test/test_enum.rb +20 -20
  42. data/test/test_equal.rb +1 -1
  43. data/test/test_tutorial_example.rb +21 -21
  44. metadata +3 -2
@@ -1,21 +1,21 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class EmployeesGroup < ActiveRecord::Base
4
-
5
- end
6
-
7
- class TestValidations < ActiveSupport::TestCase
8
- fixtures :employees
9
-
10
- def test_delete_for_model_without_primary_key
11
- EmployeesGroup.create(employee_id: 1, group_id: 100)
12
- EmployeesGroup.create(employee_id: 2, group_id: 102)
13
- EmployeesGroup.create(employee_id: 3, group_id: 103)
14
-
15
- assert_equal(EmployeesGroup.all.size, 3)
16
- assert_raises(ActiveRecord::StatementInvalid) {
17
- EmployeesGroup.where(employee_id: 1).first.destroy
18
- }
19
- assert(EmployeesGroup.all.size == 3)
20
- end
21
- end
1
+ require File.expand_path('../abstract_unit', __FILE__)
2
+
3
+ class EmployeesGroup < ActiveRecord::Base
4
+
5
+ end
6
+
7
+ class TestValidations < ActiveSupport::TestCase
8
+ fixtures :employees
9
+
10
+ def test_delete_for_model_without_primary_key
11
+ EmployeesGroup.create(employee_id: 1, group_id: 100)
12
+ EmployeesGroup.create(employee_id: 2, group_id: 102)
13
+ EmployeesGroup.create(employee_id: 3, group_id: 103)
14
+
15
+ assert_equal(EmployeesGroup.all.size, 3)
16
+ assert_raises(ActiveRecord::StatementInvalid) {
17
+ EmployeesGroup.where(employee_id: 1).first.destroy
18
+ }
19
+ assert(EmployeesGroup.all.size == 3)
20
+ end
21
+ end
@@ -1,20 +1,20 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class TestEnum < ActiveSupport::TestCase
4
- fixtures :comments
5
-
6
- def test_enum_was
7
- comment = Comment.first
8
- assert_nil comment.shown
9
-
10
- comment.shown = :true
11
- assert_equal 'true', comment.shown
12
- assert_nil comment.shown_was
13
-
14
- comment.save
15
-
16
- comment.shown = :false
17
- assert_equal 'false', comment.shown
18
- assert_equal 'true', comment.shown_was
19
- end
20
- end
1
+ require File.expand_path('../abstract_unit', __FILE__)
2
+
3
+ class TestEnum < ActiveSupport::TestCase
4
+ fixtures :comments
5
+
6
+ def test_enum_was
7
+ comment = Comment.first
8
+ assert_nil comment.shown
9
+
10
+ comment.shown = :true
11
+ assert_equal 'true', comment.shown
12
+ assert_nil comment.shown_was
13
+
14
+ comment.save
15
+
16
+ comment.shown = :false
17
+ assert_equal 'false', comment.shown
18
+ assert_equal 'true', comment.shown_was
19
+ end
20
+ end
@@ -4,7 +4,7 @@ class TestEqual < ActiveSupport::TestCase
4
4
  fixtures :capitols
5
5
 
6
6
  def test_new
7
- assert_not_equal(Capitol.new, Capitol.new)
7
+ assert_equal(Capitol.new, Capitol.new)
8
8
  end
9
9
 
10
10
  def test_same_new
@@ -1,22 +1,22 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class TestTutorialExample < ActiveSupport::TestCase
4
- fixtures :users, :groups, :memberships, :membership_statuses
5
-
6
- def test_membership
7
- assert(membership = Membership.find([1, 1]), "Cannot find a membership")
8
- assert(membership.user)
9
- assert(membership.group)
10
- end
11
-
12
- def test_status
13
- assert(membership = Membership.find([1, 1]), "Cannot find a membership")
14
- assert(statuses = membership.statuses, "No has_many association to status")
15
- assert_equal(membership, statuses.first.membership)
16
- end
17
-
18
- def test_count
19
- assert(membership = Membership.find([1, 1]), "Cannot find a membership")
20
- assert_equal(1, membership.statuses.count)
21
- end
1
+ require File.expand_path('../abstract_unit', __FILE__)
2
+
3
+ class TestTutorialExample < ActiveSupport::TestCase
4
+ fixtures :users, :groups, :memberships, :membership_statuses
5
+
6
+ def test_membership
7
+ assert(membership = Membership.find([1, 1]), "Cannot find a membership")
8
+ assert(membership.user)
9
+ assert(membership.group)
10
+ end
11
+
12
+ def test_status
13
+ assert(membership = Membership.find([1, 1]), "Cannot find a membership")
14
+ assert(statuses = membership.statuses, "No has_many association to status")
15
+ assert_equal(membership, statuses.first.membership)
16
+ end
17
+
18
+ def test_count
19
+ assert(membership = Membership.find([1, 1]), "Cannot find a membership")
20
+ assert_equal(1, membership.statuses.count)
21
+ end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composite_primary_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.13
4
+ version: 7.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -57,6 +57,7 @@ files:
57
57
  - lib/composite_primary_keys/connection_adapters/abstract/connection_specification_changes.rb
58
58
  - lib/composite_primary_keys/connection_adapters/abstract_adapter.rb
59
59
  - lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb
60
+ - lib/composite_primary_keys/connection_adapters/sqlserver_adapter.rb
60
61
  - lib/composite_primary_keys/core.rb
61
62
  - lib/composite_primary_keys/dirty.rb
62
63
  - lib/composite_primary_keys/fixtures.rb