composite_primary_keys 9.0.4 → 9.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +20 -0
  3. data/Rakefile +37 -34
  4. data/lib/composite_primary_keys.rb +5 -10
  5. data/lib/composite_primary_keys/arel/in.rb +6 -6
  6. data/lib/composite_primary_keys/arel/sqlserver.rb +36 -0
  7. data/lib/composite_primary_keys/associations/association_scope.rb +51 -29
  8. data/lib/composite_primary_keys/attribute_methods/read.rb +3 -1
  9. data/lib/composite_primary_keys/connection_adapters/abstract_mysql_adapter.rb +22 -0
  10. data/lib/composite_primary_keys/relation.rb +30 -0
  11. data/lib/composite_primary_keys/relation/query_methods.rb +25 -36
  12. data/lib/composite_primary_keys/sanitization.rb +31 -47
  13. data/lib/composite_primary_keys/version.rb +1 -1
  14. data/tasks/databases/mysql.rake +40 -42
  15. data/tasks/databases/oracle.rake +29 -15
  16. data/tasks/databases/postgresql.rake +38 -47
  17. data/tasks/databases/sqlite.rake +25 -0
  18. data/tasks/databases/sqlserver.rake +32 -16
  19. data/test/abstract_unit.rb +12 -11
  20. data/test/connections/connection_spec.rb +27 -18
  21. data/test/connections/databases.ci.yml +5 -4
  22. data/test/connections/databases.example.yml +19 -4
  23. data/test/connections/databases.yml +25 -4
  24. data/test/fixtures/article.rb +6 -5
  25. data/test/fixtures/db_definitions/mysql.sql +16 -7
  26. data/test/fixtures/db_definitions/oracle.drop.sql +2 -0
  27. data/test/fixtures/db_definitions/oracle.sql +25 -15
  28. data/test/fixtures/db_definitions/postgresql.sql +11 -2
  29. data/test/fixtures/db_definitions/sqlite.sql +8 -0
  30. data/test/fixtures/db_definitions/sqlserver.sql +19 -33
  31. data/test/fixtures/pk_called_id.rb +5 -0
  32. data/test/fixtures/pk_called_ids.yml +11 -0
  33. data/test/test_associations.rb +334 -332
  34. data/test/test_create.rb +9 -1
  35. data/test/test_delete.rb +17 -39
  36. data/test/test_ids.rb +113 -109
  37. data/test/test_preload.rb +94 -0
  38. data/test/test_suite.rb +1 -1
  39. data/test/test_update.rb +12 -7
  40. metadata +14 -24
  41. data/lib/composite_primary_keys/associations/singular_association.rb +0 -14
  42. data/lib/composite_primary_keys/connection_adapters/abstract/connection_specification_changes.rb +0 -71
  43. data/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +0 -50
  44. data/lib/composite_primary_keys/dirty.rb +0 -19
  45. data/lib/composite_primary_keys/validations/uniqueness.rb +0 -41
  46. data/tasks/databases/oracle_enhanced.rake +0 -27
  47. data/tasks/databases/sqlite3.rake +0 -27
  48. data/test/connections/native_ibm_db/connection.rb +0 -19
  49. data/test/connections/native_mysql/connection.rb +0 -17
  50. data/test/connections/native_oracle/connection.rb +0 -11
  51. data/test/connections/native_oracle_enhanced/connection.rb +0 -16
  52. data/test/connections/native_postgresql/connection.rb +0 -13
  53. data/test/connections/native_sqlite3/connection.rb +0 -9
  54. data/test/connections/native_sqlserver/connection.rb +0 -11
  55. data/test/fixtures/db_definitions/sqlserver.drop.sql +0 -92
  56. data/test/test_delete_all.rb +0 -29
@@ -1,59 +1,43 @@
1
1
  module ActiveRecord
2
2
  module Sanitization
3
3
  module ClassMethods
4
-
5
4
  protected
6
- # Accepts a hash of SQL conditions and replaces those attributes
7
- # that correspond to a {#composed_of}[rdoc-ref:Aggregations::ClassMethods#composed_of]
8
- # relationship with their expanded aggregate attribute values.
9
- #
10
- # Given:
11
- #
12
- # class Person < ActiveRecord::Base
13
- # composed_of :address, class_name: "Address",
14
- # mapping: [%w(address_street street), %w(address_city city)]
15
- # end
16
- #
17
- # Then:
18
- #
19
- # { address: Address.new("813 abc st.", "chicago") }
20
- # # => { address_street: "813 abc st.", address_city: "chicago" }
21
- silence_warnings do
22
- def expand_hash_conditions_for_aggregates(attrs)
23
- expanded_attrs = {}
24
- attrs.each do |attr, value|
25
- # CPK
26
- # if aggregation = reflect_on_aggregation(attr.to_sym)
27
- if attr.is_a?(CompositePrimaryKeys::CompositeKeys)
28
- attr.each_with_index do |key,i|
29
- expanded_attrs[key] = value.respond_to?(:flatten) ? value.flatten[i] : value
30
- end
31
- elsif aggregation = reflect_on_aggregation(attr.to_sym)
32
- mapping = aggregation.mapping
33
- mapping.each do |field_attr, aggregate_attr|
34
- if mapping.size == 1 && !value.respond_to?(aggregate_attr)
35
- expanded_attrs[field_attr] = value
36
- else
37
- expanded_attrs[field_attr] = value.send(aggregate_attr)
38
- end
5
+
6
+ def expand_hash_conditions_for_aggregates(attrs)
7
+ expanded_attrs = {}
8
+ attrs.each do |attr, value|
9
+ # CPK
10
+ # if aggregation = reflect_on_aggregation(attr.to_sym)
11
+ if attr.is_a?(CompositePrimaryKeys::CompositeKeys)
12
+ value = value.split('/') if value.is_a?(String)
13
+ attr.each_with_index do |key,i|
14
+ expanded_attrs[key] = value.respond_to?(:flatten) ? value.flatten[i] : value
15
+ end
16
+ elsif aggregation = reflect_on_aggregation(attr.to_sym)
17
+ mapping = aggregation.mapping
18
+ mapping.each do |field_attr, aggregate_attr|
19
+ if mapping.size == 1 && !value.respond_to?(aggregate_attr)
20
+ expanded_attrs[field_attr] = value
21
+ else
22
+ expanded_attrs[field_attr] = value.send(aggregate_attr)
39
23
  end
40
- else
41
- expanded_attrs[attr] = value
42
24
  end
25
+ else
26
+ expanded_attrs[attr] = value
43
27
  end
44
- expanded_attrs
45
28
  end
29
+ expanded_attrs
30
+ end
46
31
 
47
- def quoted_id
48
- # CPK
49
- # self.class.quote_value(@attributes[self.class.primary_key].value_for_database)
50
- if self.composite?
51
- [self.class.primary_keys, ids].transpose.map { |attr_name,id|
52
- self.class.quote_value(@attributes[attr_name].value_for_database)
53
- }
54
- else
55
- self.class.quote_value(@attributes[self.class.primary_key].value_for_database)
56
- end
32
+ def quoted_id
33
+ # CPK
34
+ # self.class.quote_value(@attributes[self.class.primary_key].value_for_database)
35
+ if self.composite?
36
+ [self.class.primary_keys, ids].transpose.map { |attr_name,id|
37
+ self.class.quote_value(@attributes[attr_name].value_for_database)
38
+ }
39
+ else
40
+ self.class.quote_value(@attributes[self.class.primary_key].value_for_database)
57
41
  end
58
42
  end
59
43
  end
@@ -2,7 +2,7 @@ module CompositePrimaryKeys
2
2
  module VERSION
3
3
  MAJOR = 9
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
@@ -1,42 +1,40 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
- namespace :mysql do
5
- desc 'Create the MySQL test database'
6
- task :create_database do
7
- ActiveRecord::Base.clear_all_connections!
8
- spec = CompositePrimaryKeys::ConnectionSpec['mysql'].dup
9
- database_name = spec.delete('database')
10
- connection = ActiveRecord::Base.establish_connection(spec)
11
- ActiveRecord::Base.connection.create_database(database_name)
12
- ActiveRecord::Base.clear_all_connections!
13
- end
14
-
15
- desc 'Build the MySQL test database'
16
- task :build_database => [:create_database] do
17
- path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'mysql.sql')
18
- sql = File.open(path, 'rb') do |file|
19
- file.read
20
- end
21
-
22
- Rake::Task['mysql:load_connection'].reenable
23
- Rake::Task['mysql:load_connection'].invoke
24
- #puts %(ActiveRecord::Base.connection.instance_variable_get(:@config)=#{(ActiveRecord::Base.connection.instance_variable_get(:@config)).inspect})
25
- sql.split(";").each do |statement|
26
- ActiveRecord::Base.connection.execute(statement) unless statement.strip.length == 0
27
- end
28
- end
29
-
30
- desc 'Drop the MySQL test database'
31
- task :drop_database => :load_connection do
32
- ActiveRecord::Base.connection.drop_database(SPEC['database'])
33
- end
34
-
35
- desc 'Rebuild the MySQL test database'
36
- task :rebuild_database => [:drop_database, :build_database]
37
-
38
- task :load_connection do
39
- require File.join(PROJECT_ROOT, "test", "connections", "native_mysql", "connection")
40
- establish_connection
41
- end
42
- end
1
+ namespace :mysql do
2
+ task :setup do
3
+ require 'bundler'
4
+ Bundler.require(:default, :mysql)
5
+ end
6
+
7
+ task :create_database => :setup do
8
+ spec = CompositePrimaryKeys::ConnectionSpec['mysql']
9
+ ActiveRecord::Base.clear_all_connections!
10
+ new_spec = spec.dup
11
+ new_spec.delete('database')
12
+ connection = ActiveRecord::Base.establish_connection(new_spec)
13
+ ActiveRecord::Base.connection.create_database(spec['database'])
14
+ ActiveRecord::Base.clear_all_connections!
15
+ end
16
+
17
+ desc 'Build the MySQL test database'
18
+ task :build_database => [:create_database] do
19
+ path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'mysql.sql')
20
+ sql = File.open(path, 'rb') do |file|
21
+ file.read
22
+ end
23
+
24
+ spec = CompositePrimaryKeys::ConnectionSpec['mysql']
25
+ connection = ActiveRecord::Base.establish_connection(spec)
26
+ sql.split(";").each do |statement|
27
+ ActiveRecord::Base.connection.execute(statement) unless statement.strip.length == 0
28
+ end
29
+ end
30
+
31
+ desc 'Drop the MySQL test database'
32
+ task :drop_database => :setup do
33
+ spec = CompositePrimaryKeys::ConnectionSpec['mysql']
34
+ connection = ActiveRecord::Base.establish_connection(spec)
35
+ ActiveRecord::Base.connection.drop_database(spec['database'])
36
+ end
37
+
38
+ desc 'Rebuild the MySQL test database'
39
+ task :rebuild_database => [:drop_database, :build_database]
40
+ end
@@ -1,27 +1,41 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
1
  namespace :oracle do
2
+ task :setup do
3
+ require 'bundler'
4
+ Bundler.require(:default, :oracle)
5
+ end
6
+
5
7
  desc 'Build the Oracle test database'
6
- task :build_database => :load_connection do
7
- options_str = connection_string
8
+ task :build_database => :setup do
9
+ spec = CompositePrimaryKeys::ConnectionSpec['oracle']
10
+ ActiveRecord::Base.clear_all_connections!
11
+ ActiveRecord::Base.establish_connection(spec)
12
+
13
+ schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.sql')
14
+ sql = File.read(schema)
15
+
16
+ sql.split(';').each do |command|
17
+ ActiveRecord::Base.connection.execute(command)
18
+ end
8
19
 
9
- sql = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.sql')
10
- sh %( sqlplus #{options_str} < #{sql} )
20
+ ActiveRecord::Base.clear_all_connections!
11
21
  end
12
22
 
13
23
  desc 'Drop the Oracle test database'
14
- task :drop_database => :load_connection do
15
- options_str = connection_string
24
+ task :drop_database => :setup do
25
+ spec = CompositePrimaryKeys::ConnectionSpec['oracle']
26
+ ActiveRecord::Base.clear_all_connections!
27
+ ActiveRecord::Base.establish_connection(spec)
16
28
 
17
- sql = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.drop.sql')
18
- sh %( sqlplus #{options_str} < #{sql} )
29
+ schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.drop.sql')
30
+ sql = File.read(schema)
31
+
32
+ sql.split(';').each do |command|
33
+ ActiveRecord::Base.connection.execute(command)
34
+ end
35
+
36
+ ActiveRecord::Base.clear_all_connections!
19
37
  end
20
38
 
21
39
  desc 'Rebuild the Oracle test database'
22
40
  task :rebuild_database => [:drop_database, :build_database]
23
-
24
- task :load_connection do
25
- require File.join(PROJECT_ROOT, "test", "connections", "native_oracle", "connection")
26
- end
27
41
  end
@@ -1,48 +1,39 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
- namespace :postgresql do
5
- desc 'Create the PostgreSQL test database'
6
- task :create_database do
7
- ActiveRecord::Base.clear_all_connections!
8
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
9
- database_name = spec.delete('database')
10
- spec['database'] = 'postgres'
11
- connection = ActiveRecord::Base.establish_connection(spec)
12
- ActiveRecord::Base.connection.create_database(database_name)
13
- ActiveRecord::Base.clear_all_connections!
14
- end
15
-
16
- desc 'Build the PostgreSQL test database'
17
- task :build_database => [:create_database] do
18
- ActiveRecord::Base.clear_all_connections!
19
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
20
- connection = ActiveRecord::Base.establish_connection(spec)
21
-
22
- path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'postgresql.sql')
23
- sql = File.open(path, 'rb') do |file|
24
- file.read
25
- end
26
-
27
- Rake::Task['postgresql:load_connection'].invoke
28
- ActiveRecord::Base.connection.execute(sql)
29
- end
30
-
31
- desc 'Drop the PostgreSQL test database'
32
- task :drop_database => :load_connection do
33
- ActiveRecord::Base.clear_all_connections!
34
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
35
- database_name = spec.delete('database')
36
- spec['database'] = 'postgres'
37
- connection = ActiveRecord::Base.establish_connection(spec)
38
- ActiveRecord::Base.connection.drop_database(SPEC['database'])
39
- ActiveRecord::Base.clear_all_connections!
40
- end
41
-
42
- desc 'Rebuild the PostgreSQL test database'
43
- task :rebuild_database => [:drop_database, :build_database]
44
-
45
- task :load_connection do
46
- require File.join(PROJECT_ROOT, "test", "connections", "native_postgresql", "connection")
47
- end
1
+ namespace :postgresql do
2
+ task :setup do
3
+ require 'bundler'
4
+ Bundler.require(:default, :postgresql)
5
+ end
6
+
7
+ task :create_database => :setup do
8
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql']
9
+ ActiveRecord::Base.clear_all_connections!
10
+ ActiveRecord::Base.establish_connection(spec.dup.merge('database' => 'postgres'))
11
+ ActiveRecord::Base.connection.create_database(spec['database'])
12
+ ActiveRecord::Base.clear_all_connections!
13
+ end
14
+
15
+ desc 'Build the Postgresql test database'
16
+ task :build_database => :create_database do
17
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql']
18
+ ActiveRecord::Base.clear_all_connections!
19
+ connection = ActiveRecord::Base.establish_connection(spec)
20
+
21
+ schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'postgresql.sql')
22
+ sql = File.read(schema)
23
+
24
+ ActiveRecord::Base.connection.execute(sql)
25
+ ActiveRecord::Base.clear_all_connections!
26
+ end
27
+
28
+ desc 'Drop the Postgresql test database'
29
+ task :drop_database => :setup do
30
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql']
31
+ ActiveRecord::Base.clear_all_connections!
32
+ connection = ActiveRecord::Base.establish_connection(spec.merge('database' => 'postgres'))
33
+ ActiveRecord::Base.connection.drop_database(spec['database'])
34
+ ActiveRecord::Base.clear_all_connections!
35
+ end
36
+
37
+ desc 'Rebuild the PostgreSQL test database'
38
+ task :rebuild_database => [:drop_database, :build_database]
48
39
  end
@@ -0,0 +1,25 @@
1
+ namespace :sqlite do
2
+ task :setup do
3
+ require 'bundler'
4
+ Bundler.require(:default, :sqlite)
5
+ end
6
+
7
+ desc 'Build the sqlite test database'
8
+ task :build_database => :setup do
9
+ spec = CompositePrimaryKeys::ConnectionSpec['sqlite']
10
+ schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlite.sql')
11
+ FileUtils.mkdir_p(File.dirname(spec['database']))
12
+ cmd = "sqlite3 #{spec['database']} < #{schema}"
13
+ puts cmd
14
+ sh %{ #{cmd} }
15
+ end
16
+
17
+ desc 'Drop the sqlite test database'
18
+ task :drop_database => :setup do
19
+ spec = CompositePrimaryKeys::ConnectionSpec['sqlite']
20
+ sh %{ rm -f #{spec['database']} }
21
+ end
22
+
23
+ desc 'Rebuild the sqlite test database'
24
+ task :rebuild_database => [:drop_database, :build_database]
25
+ end
@@ -1,27 +1,43 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
1
  namespace :sqlserver do
5
- desc 'Build the SQL Server test database'
6
- task :build_database => :load_connection do
7
- options_str = connection_string
2
+ task :setup do
3
+ require 'bundler'
4
+ Bundler.require(:default, :sqlserver)
5
+ end
6
+
7
+ task :create_database => :setup do
8
+ spec = CompositePrimaryKeys::ConnectionSpec['sqlserver']
9
+ database = spec.delete('database')
10
+ ActiveRecord::Base.clear_all_connections!
11
+
12
+ ActiveRecord::Base.establish_connection(spec)
13
+ ActiveRecord::Base.connection.execute("CREATE DATABASE [#{database}]")
14
+ ActiveRecord::Base.clear_all_connections!
15
+ end
16
+
17
+ task :build_database => :create_database do
18
+ spec = CompositePrimaryKeys::ConnectionSpec['sqlserver']
19
+ ActiveRecord::Base.establish_connection(spec)
8
20
 
9
21
  schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlserver.sql')
10
- sh %( sqsh #{options_str} -i #{schema} )
22
+ sql = File.read(schema)
23
+ ActiveRecord::Base.connection.execute(sql)
24
+ ActiveRecord::Base.clear_all_connections!
11
25
  end
12
26
 
13
27
  desc 'Drop the SQL Server test database'
14
- task :drop_database => :load_connection do
15
- options_str = connection_string
16
-
17
- schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlserver.drop.sql')
18
- sh %( sqsh #{options_str} -i #{schema} )
28
+ task :drop_database => :setup do
29
+ spec = CompositePrimaryKeys::ConnectionSpec['sqlserver']
30
+ ActiveRecord::Base.clear_all_connections!
31
+ ActiveRecord::Base.establish_connection(spec)
32
+ database = spec.delete('database')
33
+ ActiveRecord::Base.connection.execute(<<-SQL)
34
+ USE master;
35
+ ALTER DATABASE [#{database}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
36
+ DROP DATABASE [#{database}];
37
+ SQL
38
+ ActiveRecord::Base.clear_all_connections!
19
39
  end
20
40
 
21
41
  desc 'Rebuild the SQL Server test database'
22
42
  task :rebuild_database => [:drop_database, :build_database]
23
-
24
- task :load_connection do
25
- require File.join(PROJECT_ROOT, "test", "connections", "native_sqlserver", "connection")
26
- end
27
43
  end
@@ -1,6 +1,6 @@
1
- ENV["TESTING_CPK"] = "true"
2
-
3
- PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
1
+ spec_name = ENV['ADAPTER'] || 'postgresql'
2
+ require 'bundler'
3
+ Bundler.require(:default, spec_name.to_sym)
4
4
 
5
5
  # To make debugging easier, test within this source tree versus an installed gem
6
6
  $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
@@ -8,14 +8,15 @@ require 'composite_primary_keys'
8
8
  require 'minitest/autorun'
9
9
  require 'active_support/test_case'
10
10
 
11
- # Now load the connection spec
12
- require File.join(PROJECT_ROOT, "test", "connections", "connection_spec")
11
+ # Require the connection spec
12
+ PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
13
+ require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
13
14
 
14
- spec_name = ENV['ADAPTER'] || 'postgresql'
15
15
  spec = CompositePrimaryKeys::ConnectionSpec[spec_name]
16
+ puts "Loaded #{spec_name}"
16
17
 
17
18
  # And now connect to the database
18
- require File.join(PROJECT_ROOT, "test", "connections", "native_#{spec_name}", "connection")
19
+ ActiveRecord::Base.establish_connection(spec)
19
20
 
20
21
  # Tell active record about the configuration
21
22
  ActiveRecord::Base.configurations[:test] = spec
@@ -28,7 +29,7 @@ I18n.config.enforce_available_locales = true
28
29
  class ActiveSupport::TestCase
29
30
  include ActiveRecord::TestFixtures
30
31
 
31
- self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
32
+ self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
32
33
  self.use_instantiated_fixtures = false
33
34
  self.use_transactional_tests = true
34
35
  self.test_order = :random
@@ -37,7 +38,7 @@ class ActiveSupport::TestCase
37
38
  # SQL Server doesn't have a separate column type just for dates,
38
39
  # so the time is in the string and incorrectly formatted
39
40
  if current_adapter?(:SQLServerAdapter)
40
- assert_equal expected.strftime("%Y/%m/%d 00:00:00"), actual.strftime("%Y/%m/%d 00:00:00")
41
+ assert_equal expected.strftime('%Y/%m/%d 00:00:00'), actual.strftime('%Y/%m/%d 00:00:00')
41
42
  elsif current_adapter?(:SybaseAdapter)
42
43
  assert_equal expected.to_s, actual.to_date.to_s, message
43
44
  else
@@ -55,7 +56,7 @@ class ActiveSupport::TestCase
55
56
  ActiveRecord::Base.connection.class.class_eval do
56
57
  alias_method :execute, :execute_without_query_counting
57
58
  end
58
- assert_equal num, ActiveRecord::Base.connection.query_count, "#{ActiveRecord::Base.connection.query_count} instead of #{num} queries were executed."
59
+ assert_equal num, ActiveRecord::Base.connection.query_count, '#{ActiveRecord::Base.connection.query_count} instead of #{num} queries were executed.'
59
60
  end
60
61
 
61
62
  def assert_no_queries(&block)
@@ -88,7 +89,7 @@ class ActiveSupport::TestCase
88
89
 
89
90
  # Oracle metadata is in all caps.
90
91
  def with_quoted_identifiers(s)
91
- s.gsub(/"(\w+)"/) { |m|
92
+ s.gsub(/'(\w+)'/) { |m|
92
93
  if ActiveRecord::Base.configurations[:test]['adapter'] =~ /oracle/i
93
94
  m.upcase
94
95
  else