composite_primary_keys 4.0.0.beta7 → 4.0.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +1 -1
- data/lib/composite_primary_keys.rb +1 -1
- data/lib/composite_primary_keys/base.rb +3 -3
- data/lib/composite_primary_keys/version.rb +1 -1
- data/tasks/databases/sqlite3.rake +2 -2
- data/test/README_tests.txt +15 -1
- data/test/abstract_unit.rb +1 -1
- data/test/connections/{native_sqlite → native_sqlite3}/connection.rb +0 -0
- data/test/test_associations.rb +1 -1
- data/test/test_attribute_methods.rb +3 -3
- data/test/test_attributes.rb +1 -1
- data/test/test_composite_arrays.rb +1 -1
- data/test/test_create.rb +1 -1
- data/test/test_delete.rb +1 -1
- data/test/test_dup.rb +1 -1
- data/test/test_equal.rb +1 -1
- data/test/test_exists.rb +1 -1
- data/test/test_find.rb +1 -1
- data/test/test_habtm.rb +1 -1
- data/test/test_ids.rb +1 -1
- data/test/test_miscellaneous.rb +1 -1
- data/test/test_pagination.rb +36 -36
- data/test/test_polymorphic.rb +1 -1
- data/test/test_predicates.rb +1 -1
- data/test/test_santiago.rb +1 -1
- data/test/test_suite.rb +20 -20
- data/test/test_tutorial_example.rb +1 -1
- data/test/test_update.rb +1 -1
- data/test/test_validations.rb +1 -1
- metadata +27 -58
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 4.0.0.beta8 2011-082-22
|
2
|
+
* Sqlite 3 fixes (Jan Vlnas)
|
3
|
+
* Fixes for to_key method (Jan Vlnas)
|
4
|
+
* Compatible with Rails 3.1 RC6 (Ari Epstein, Travis Warlick)
|
5
|
+
|
1
6
|
== 4.0.0.beta7 2011-07-26
|
2
7
|
* Compatible with Rails 3.1 RC5 (TycoooN)
|
3
8
|
* Do not use Arel::Nodes::Or to combine predicates because it creates a
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ Dir.glob('tasks/**/*.rake').each do |rake_file|
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Set up test tasks for each supported connection adapter
|
23
|
-
%w(mysql
|
23
|
+
%w(mysql sqlite3 oracle oracle_enhanced postgresql ibm_db).each do |adapter|
|
24
24
|
namespace adapter do
|
25
25
|
desc "Run tests using the #{adapter} adapter"
|
26
26
|
task "test" do
|
@@ -125,10 +125,10 @@ module ActiveRecord
|
|
125
125
|
false
|
126
126
|
end
|
127
127
|
|
128
|
-
# Returns this record's primary keys values in an Array
|
129
|
-
#
|
128
|
+
# Returns this record's primary keys values in an Array
|
129
|
+
# if any value is avaliable
|
130
130
|
def to_key
|
131
|
-
ids.to_a if
|
131
|
+
ids.to_a if !ids.compact.empty? # XXX Maybe use primary_keys with send instead of ids
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -24,6 +24,6 @@ namespace :sqlite3 do
|
|
24
24
|
task :rebuild_databases => [:drop_databases, :build_databases]
|
25
25
|
|
26
26
|
task :load_connection do
|
27
|
-
require File.join(PROJECT_ROOT, "test", "connections", "
|
27
|
+
require File.join(PROJECT_ROOT, "test", "connections", "native_sqlite3", "connection")
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
data/test/README_tests.txt
CHANGED
@@ -9,10 +9,24 @@ There are tests available for the following adapters:
|
|
9
9
|
* oracle
|
10
10
|
* oracle_enhanced
|
11
11
|
* postgresql
|
12
|
-
*
|
12
|
+
* sqlite3
|
13
13
|
|
14
14
|
To run the tests for one of the adapters follow these steps (using mysql in the example):
|
15
15
|
|
16
|
+
* You will need the following gems:
|
17
|
+
- rake
|
18
|
+
- activerecord (3.1.0.rc5 or later)
|
19
|
+
- mysql (or the adapter of your choice)
|
20
|
+
|
21
|
+
* Put your mysql connection settings to test/connections/databases.yml
|
22
|
+
look into databases.example.sql for reference,
|
23
|
+
keep only one connection spec at once in databases.yml
|
24
|
+
|
25
|
+
mysql:
|
26
|
+
adapter: mysql
|
27
|
+
username: root
|
28
|
+
database: composite_primary_keys_unittest
|
29
|
+
|
16
30
|
* rake -T mysql
|
17
31
|
|
18
32
|
rake mysql:build_databases # Build the MySQL test databases
|
data/test/abstract_unit.rb
CHANGED
@@ -2,7 +2,7 @@ PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
|
2
2
|
|
3
3
|
require "pp"
|
4
4
|
require "test/unit"
|
5
|
-
require "hash_tricks"
|
5
|
+
require "./hash_tricks"
|
6
6
|
|
7
7
|
# To make debugging easier, test within this source tree versus an installed gem
|
8
8
|
#require 'composite_primary_keys'
|
File without changes
|
data/test/test_associations.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'abstract_unit'
|
1
|
+
require './abstract_unit'
|
2
2
|
|
3
3
|
class TestAttributeMethods < ActiveSupport::TestCase
|
4
4
|
fixtures :reference_types
|
@@ -42,13 +42,13 @@ class TestAttributeMethods < ActiveSupport::TestCase
|
|
42
42
|
def test_to_key_with_single_key_destroyed
|
43
43
|
rt = ReferenceType.find(1)
|
44
44
|
rt.destroy
|
45
|
-
|
45
|
+
assert_equal([1], rt.to_key)
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_to_key_with_composite_key_destroyed
|
49
49
|
ref_code = ReferenceCode.find(1, 1)
|
50
50
|
ref_code.destroy
|
51
|
-
|
51
|
+
assert_equal([1,1], ref_code.to_key)
|
52
52
|
end
|
53
53
|
|
54
54
|
|
data/test/test_attributes.rb
CHANGED
data/test/test_create.rb
CHANGED
data/test/test_delete.rb
CHANGED
data/test/test_dup.rb
CHANGED
data/test/test_equal.rb
CHANGED
data/test/test_exists.rb
CHANGED
data/test/test_find.rb
CHANGED
data/test/test_habtm.rb
CHANGED
data/test/test_ids.rb
CHANGED
data/test/test_miscellaneous.rb
CHANGED
data/test/test_pagination.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
require 'abstract_unit'
|
2
|
-
require 'plugins/pagination'
|
3
|
-
|
4
|
-
class TestPagination < ActiveSupport::TestCase
|
5
|
-
fixtures :reference_types, :reference_codes
|
6
|
-
|
7
|
-
include ActionController::Pagination
|
8
|
-
DEFAULT_PAGE_SIZE = 2
|
9
|
-
|
10
|
-
attr_accessor :params
|
11
|
-
|
12
|
-
CLASSES = {
|
13
|
-
:single => {
|
14
|
-
:class => ReferenceType,
|
15
|
-
:primary_keys => :reference_type_id,
|
16
|
-
:table => :reference_types,
|
17
|
-
},
|
18
|
-
:dual => {
|
19
|
-
:class => ReferenceCode,
|
20
|
-
:primary_keys => [:reference_type_id, :reference_code],
|
21
|
-
:table => :reference_codes,
|
22
|
-
},
|
23
|
-
}
|
24
|
-
|
25
|
-
def setup
|
26
|
-
self.class.classes = CLASSES
|
27
|
-
@params = {}
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_paginate_all
|
31
|
-
testing_with do
|
32
|
-
@object_pages, @objects = paginate @klass_info[:table], :per_page => DEFAULT_PAGE_SIZE
|
33
|
-
assert_equal 2, @objects.length, "Each page should have #{DEFAULT_PAGE_SIZE} items"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
#require './abstract_unit'
|
2
|
+
#require 'plugins/pagination'
|
3
|
+
#
|
4
|
+
#class TestPagination < ActiveSupport::TestCase
|
5
|
+
# fixtures :reference_types, :reference_codes
|
6
|
+
#
|
7
|
+
# include ActionController::Pagination
|
8
|
+
# DEFAULT_PAGE_SIZE = 2
|
9
|
+
#
|
10
|
+
# attr_accessor :params
|
11
|
+
#
|
12
|
+
# CLASSES = {
|
13
|
+
# :single => {
|
14
|
+
# :class => ReferenceType,
|
15
|
+
# :primary_keys => :reference_type_id,
|
16
|
+
# :table => :reference_types,
|
17
|
+
# },
|
18
|
+
# :dual => {
|
19
|
+
# :class => ReferenceCode,
|
20
|
+
# :primary_keys => [:reference_type_id, :reference_code],
|
21
|
+
# :table => :reference_codes,
|
22
|
+
# },
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# def setup
|
26
|
+
# self.class.classes = CLASSES
|
27
|
+
# @params = {}
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# def test_paginate_all
|
31
|
+
# testing_with do
|
32
|
+
# @object_pages, @objects = paginate @klass_info[:table], :per_page => DEFAULT_PAGE_SIZE
|
33
|
+
# assert_equal 2, @objects.length, "Each page should have #{DEFAULT_PAGE_SIZE} items"
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
#end
|
data/test/test_polymorphic.rb
CHANGED
data/test/test_predicates.rb
CHANGED
data/test/test_santiago.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Test cases devised by Santiago that broke the Composite Primary Keys
|
2
2
|
# code at one point in time. But no more!!!
|
3
|
-
require 'abstract_unit'
|
3
|
+
require './abstract_unit'
|
4
4
|
|
5
5
|
class TestSantiago < ActiveSupport::TestCase
|
6
6
|
fixtures :suburbs, :streets, :users, :articles, :readings
|
data/test/test_suite.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
|
-
require 'test_associations'
|
4
|
-
require 'test_attribute_methods'
|
5
|
-
require 'test_attributes'
|
6
|
-
require 'test_composite_arrays'
|
7
|
-
require 'test_create'
|
8
|
-
require 'test_delete'
|
9
|
-
require 'test_dup'
|
10
|
-
require 'test_equal'
|
11
|
-
require 'test_exists'
|
12
|
-
require 'test_find'
|
13
|
-
require 'test_habtm'
|
14
|
-
require 'test_ids'
|
15
|
-
require 'test_miscellaneous'
|
16
|
-
require 'test_pagination'
|
17
|
-
require 'test_polymorphic'
|
18
|
-
require 'test_predicates'
|
19
|
-
require 'test_santiago'
|
20
|
-
require 'test_tutorial_example'
|
21
|
-
require 'test_update'
|
22
|
-
require 'test_validations'
|
3
|
+
require './test_associations'
|
4
|
+
require './test_attribute_methods'
|
5
|
+
require './test_attributes'
|
6
|
+
require './test_composite_arrays'
|
7
|
+
require './test_create'
|
8
|
+
require './test_delete'
|
9
|
+
require './test_dup'
|
10
|
+
require './test_equal'
|
11
|
+
require './test_exists'
|
12
|
+
require './test_find'
|
13
|
+
require './test_habtm'
|
14
|
+
require './test_ids'
|
15
|
+
require './test_miscellaneous'
|
16
|
+
require './test_pagination'
|
17
|
+
require './test_polymorphic'
|
18
|
+
require './test_predicates'
|
19
|
+
require './test_santiago'
|
20
|
+
require './test_tutorial_example'
|
21
|
+
require './test_update'
|
22
|
+
require './test_validations'
|
data/test/test_update.rb
CHANGED
data/test/test_validations.rb
CHANGED
metadata
CHANGED
@@ -1,53 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: composite_primary_keys
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.0.0.beta8
|
5
5
|
prerelease: 6
|
6
|
-
segments:
|
7
|
-
- 4
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
- beta
|
11
|
-
- 7
|
12
|
-
version: 4.0.0.beta7
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Dr Nic Williams
|
16
9
|
- Charlie Savage
|
17
10
|
autorequire:
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-08-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
24
16
|
name: activerecord
|
25
|
-
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &21190524 !ruby/object:Gem::Requirement
|
27
18
|
none: false
|
28
|
-
requirements:
|
29
|
-
- -
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 15424111
|
32
|
-
segments:
|
33
|
-
- 3
|
34
|
-
- 1
|
35
|
-
- 0
|
36
|
-
- rc
|
37
|
-
- 5
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
38
22
|
version: 3.1.0.rc5
|
39
23
|
type: :runtime
|
40
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *21190524
|
41
26
|
description: Composite key support for ActiveRecord 3
|
42
|
-
email:
|
27
|
+
email:
|
43
28
|
- drnicwilliams@gmail.com
|
44
29
|
executables: []
|
45
|
-
|
46
30
|
extensions: []
|
47
|
-
|
48
31
|
extra_rdoc_files: []
|
49
|
-
|
50
|
-
files:
|
32
|
+
files:
|
51
33
|
- Rakefile
|
52
34
|
- History.txt
|
53
35
|
- README.txt
|
@@ -101,7 +83,7 @@ files:
|
|
101
83
|
- test/connections/native_oracle/connection.rb
|
102
84
|
- test/connections/native_oracle_enhanced/connection.rb
|
103
85
|
- test/connections/native_postgresql/connection.rb
|
104
|
-
- test/connections/
|
86
|
+
- test/connections/native_sqlite3/connection.rb
|
105
87
|
- test/db_test.rb
|
106
88
|
- test/debug.log
|
107
89
|
- test/fixtures/article.rb
|
@@ -192,42 +174,29 @@ files:
|
|
192
174
|
- test/test_validations.rb
|
193
175
|
homepage: http://github.com/cfis/composite_primary_keys
|
194
176
|
licenses: []
|
195
|
-
|
196
177
|
post_install_message:
|
197
178
|
rdoc_options: []
|
198
|
-
|
199
|
-
require_paths:
|
179
|
+
require_paths:
|
200
180
|
- lib
|
201
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
202
182
|
none: false
|
203
|
-
requirements:
|
204
|
-
- -
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
hash: 57
|
207
|
-
segments:
|
208
|
-
- 1
|
209
|
-
- 8
|
210
|
-
- 7
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
211
186
|
version: 1.8.7
|
212
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
188
|
none: false
|
214
|
-
requirements:
|
215
|
-
- -
|
216
|
-
- !ruby/object:Gem::Version
|
217
|
-
hash: 25
|
218
|
-
segments:
|
219
|
-
- 1
|
220
|
-
- 3
|
221
|
-
- 1
|
189
|
+
requirements:
|
190
|
+
- - ! '>'
|
191
|
+
- !ruby/object:Gem::Version
|
222
192
|
version: 1.3.1
|
223
193
|
requirements: []
|
224
|
-
|
225
194
|
rubyforge_project: compositekeys
|
226
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.8
|
227
196
|
signing_key:
|
228
197
|
specification_version: 3
|
229
198
|
summary: Composite key support for ActiveRecord
|
230
|
-
test_files:
|
199
|
+
test_files:
|
231
200
|
- test/abstract_unit.rb
|
232
201
|
- test/db_test.rb
|
233
202
|
- test/debug.log
|