activerecord-nulldb-adapter 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 549701beff755acbddfa3f40df47ed433e5c375a
4
- data.tar.gz: cac3d927d0a2de9b0b8580a0a2fdf7bba08e8cea
3
+ metadata.gz: e7a2b38931986ca22035d58a578fa13a21f74360
4
+ data.tar.gz: 5700dffe9b6c19f8ff9c9e0b8cb3c81887c9dde1
5
5
  SHA512:
6
- metadata.gz: ebbad7668370b74ab58dd2b66a55aa83ed7d6774c160023f2083a671da60dd1be95073d455fd8d5dfff1940ce8e71935670c15588f09ec702da6f16aef1fd8f8
7
- data.tar.gz: 4252eca9c83848ab88128d425a1de54e2dad30e8a97f3eebdfb6dd8878fbdd54f40e798d4ebdde72dba516a4dba465617185cd9c5f5728c7f214c17462ce34c4
6
+ metadata.gz: ace3f7f82325a86cb9744fa365f740ab9317961f724412d07dfc0b8f6e83948a8b98375a228ab9721a230466908f1ed4440c268edfc555be3fd7081c0c119890
7
+ data.tar.gz: 745b6c3543a7e59563cfbf78edf65345e248641d5b7e9fb90389686ee0375718ca523dc52e4db39a2a12a420a9d1e2829ed2a32242fea5e7f3038cec91f09d84
@@ -0,0 +1,28 @@
1
+ # generated coverage
2
+ coverage
3
+ coverage.data
4
+
5
+ # docs
6
+ rdoc
7
+ doc
8
+ .yardoc
9
+
10
+ # bundler
11
+ .bundle
12
+ *.lock
13
+
14
+ # gem
15
+ pkg
16
+
17
+ # mac os specific
18
+ .DS_Store
19
+
20
+ # vim
21
+ *.swp
22
+
23
+ # rvm
24
+ .rvmrc
25
+ .ruby-*
26
+
27
+ # ginger
28
+ .ginger
@@ -4,6 +4,7 @@ bundler_args: --without development
4
4
  sudo: false
5
5
 
6
6
  rvm:
7
+ - 1.9.3
7
8
  - 2.1.10
8
9
  - 2.2.5
9
10
  - 2.3.1
@@ -15,6 +16,17 @@ matrix:
15
16
  allow_failures:
16
17
  - rvm: jruby
17
18
  - rvm: rbx
19
+ exclude:
20
+ - rvm: 1.9.3
21
+ gemfile: gemfiles/activerecord_5.0.gemfile
22
+ - rvm: 2.1.10
23
+ gemfile: gemfiles/activerecord_5.0.gemfile
24
+ - rvm: 2.1.10
25
+ gemfile: gemfiles/activerecord_2.3.gemfile
26
+ - rvm: 2.2.5
27
+ gemfile: gemfiles/activerecord_2.3.gemfile
28
+ - rvm: 2.3.1
29
+ gemfile: gemfiles/activerecord_2.3.gemfile
18
30
 
19
31
  gemfile:
20
32
  - gemfiles/activerecord_2.3.gemfile
@@ -24,3 +36,4 @@ gemfile:
24
36
  - gemfiles/activerecord_4.0.gemfile
25
37
  - gemfiles/activerecord_4.1.gemfile
26
38
  - gemfiles/activerecord_4.2.gemfile
39
+ - gemfiles/activerecord_5.0.gemfile
data/Appraisals CHANGED
@@ -26,3 +26,7 @@ end
26
26
  appraise "activerecord-4.2" do
27
27
  gem "activerecord", "~> 4.2.0"
28
28
  end
29
+
30
+ appraise "activerecord-5.0" do
31
+ gem "activerecord", "~> 5.0.0"
32
+ end
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.3.6 (2016-11-23)
2
+ -----------
3
+ - Adds support for ActiveRecord 5.0.
4
+
5
+
1
6
  0.3.5 (2016-09-26)
2
7
  -----------
3
8
  - Adds support for #cast_values on EmptyResult instance.
data/Gemfile CHANGED
@@ -9,7 +9,6 @@ group :development, :test do
9
9
  end
10
10
 
11
11
  group :development do
12
- gem 'jeweler'
13
12
  gem 'appraisal'
14
13
  gem 'simplecov', :require => false
15
14
  end
@@ -16,14 +16,14 @@ a real database.
16
16
  == Compatibility
17
17
 
18
18
  === Ruby
19
- Currently supported Ruby versions: MRI 2.0.0, 2.1.x, 2.2.x, 2.3.x
19
+ Currently supported Ruby versions: MRI 1.9.3, 2.0.0, 2.1.x, 2.2.x, 2.3.x
20
20
 
21
21
  Experimental support provided for: JRuby, Rubinius (both in 1.9 mode)
22
22
 
23
23
  === ActiveRecord
24
- Any version of ActiveRecord since 2.0, including ActiveRecord 4.0
24
+ Any version of ActiveRecord since 2.0, including ActiveRecord 5.0
25
25
 
26
- It is tested against AR 2.3, 3.0, 3.1, 3.2, 4.0 and 4.1.
26
+ It is tested against AR 2.3, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2 and 5.0.
27
27
 
28
28
  == Installation
29
29
 
data/Rakefile CHANGED
@@ -2,23 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- gem.name = 'activerecord-nulldb-adapter'
9
- gem.summary = %Q{The Null Object pattern as applied to ActiveRecord database adapters}
10
- gem.description = %Q{A database backend that translates database interactions into no-ops. Using NullDB enables you to test your model business logic - including after_save hooks - without ever touching a real database.}
11
- gem.email = "myron.marston@gmail.com"
12
- gem.homepage = "http://github.com/nulldb/nulldb"
13
- gem.authors = ["Avdi Grimm", "Myron Marston"]
14
- gem.rubyforge_project = "nulldb"
15
- gem.license = "MIT"
16
-
17
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
- end
19
- Jeweler::GemcutterTasks.new
20
- rescue LoadError
21
- end
5
+ require 'bundler/gem_tasks'
22
6
 
23
7
  RSpec::Core::RakeTask.new(:spec)
24
8
  task :default => :spec
@@ -28,8 +12,3 @@ Rake::RDocTask.new do |rd|
28
12
  rd.main = "README.rdoc"
29
13
  rd.rdoc_files.include("README.rdoc", "LICENSE", "lib/**/*.rb")
30
14
  end
31
-
32
- desc "Publish project home page"
33
- task :publish => ["rdoc"] do
34
- sh "scp -r html/* myronmarston@rubyforge.org:/var/www/gforge-projects/nulldb"
35
- end
@@ -1,95 +1,27 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: activerecord-nulldb-adapter 0.3.5 ruby lib
1
+ # coding: utf-8
6
2
 
7
3
  Gem::Specification.new do |s|
8
4
  s.name = "activerecord-nulldb-adapter"
9
- s.version = "0.3.5"
5
+ s.version = "0.3.6"
10
6
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
7
  s.require_paths = ["lib"]
13
8
  s.authors = ["Avdi Grimm", "Myron Marston"]
14
- s.date = "2016-09-26"
9
+ s.summary = "The Null Object pattern as applied to ActiveRecord database adapters"
15
10
  s.description = "A database backend that translates database interactions into no-ops. Using NullDB enables you to test your model business logic - including after_save hooks - without ever touching a real database."
16
11
  s.email = "myron.marston@gmail.com"
17
12
  s.extra_rdoc_files = [
18
13
  "LICENSE",
19
14
  "README.rdoc"
20
15
  ]
21
- s.files = [
22
- ".travis.yml",
23
- "Appraisals",
24
- "CHANGES.md",
25
- "Gemfile",
26
- "LICENSE",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "activerecord-nulldb-adapter.gemspec",
31
- "gemfiles/activerecord_2.3.gemfile",
32
- "gemfiles/activerecord_3.0.gemfile",
33
- "gemfiles/activerecord_3.1.gemfile",
34
- "gemfiles/activerecord_3.2.gemfile",
35
- "gemfiles/activerecord_4.0.gemfile",
36
- "gemfiles/activerecord_4.1.gemfile",
37
- "gemfiles/activerecord_4.2.gemfile",
38
- "lib/active_record/connection_adapters/nulldb_adapter.rb",
39
- "lib/active_record/connection_adapters/nulldb_adapter/checkpoint.rb",
40
- "lib/active_record/connection_adapters/nulldb_adapter/column.rb",
41
- "lib/active_record/connection_adapters/nulldb_adapter/configuration.rb",
42
- "lib/active_record/connection_adapters/nulldb_adapter/core.rb",
43
- "lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb",
44
- "lib/active_record/connection_adapters/nulldb_adapter/index_definition.rb",
45
- "lib/active_record/connection_adapters/nulldb_adapter/null_object.rb",
46
- "lib/active_record/connection_adapters/nulldb_adapter/statement.rb",
47
- "lib/active_record/connection_adapters/nulldb_adapter/table_definition.rb",
48
- "lib/activerecord-nulldb-adapter.rb",
49
- "lib/nulldb.rb",
50
- "lib/nulldb/arel_compiler.rb",
51
- "lib/nulldb/core.rb",
52
- "lib/nulldb/extensions.rb",
53
- "lib/nulldb/rails.rb",
54
- "lib/nulldb_rspec.rb",
55
- "lib/tasks/database.rake",
56
- "spec/nulldb_spec.rb",
57
- "spec/spec.opts"
58
- ]
16
+ s.files = `git ls-files`.split($/)
59
17
  s.homepage = "http://github.com/nulldb/nulldb"
60
18
  s.licenses = ["MIT"]
61
- s.rubyforge_project = "nulldb"
62
- s.rubygems_version = "2.4.8"
63
- s.summary = "The Null Object pattern as applied to ActiveRecord database adapters"
64
-
65
- if s.respond_to? :specification_version then
66
- s.specification_version = 4
67
19
 
68
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<activerecord>, [">= 2.0.0"])
70
- s.add_development_dependency(%q<spec>, [">= 0"])
71
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
72
- s.add_development_dependency(%q<rake>, [">= 0"])
73
- s.add_development_dependency(%q<jeweler>, [">= 0"])
74
- s.add_development_dependency(%q<appraisal>, [">= 0"])
75
- s.add_development_dependency(%q<simplecov>, [">= 0"])
76
- else
77
- s.add_dependency(%q<activerecord>, [">= 2.0.0"])
78
- s.add_dependency(%q<spec>, [">= 0"])
79
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
80
- s.add_dependency(%q<rake>, [">= 0"])
81
- s.add_dependency(%q<jeweler>, [">= 0"])
82
- s.add_dependency(%q<appraisal>, [">= 0"])
83
- s.add_dependency(%q<simplecov>, [">= 0"])
84
- end
85
- else
86
- s.add_dependency(%q<activerecord>, [">= 2.0.0"])
87
- s.add_dependency(%q<spec>, [">= 0"])
88
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
89
- s.add_dependency(%q<rake>, [">= 0"])
90
- s.add_dependency(%q<jeweler>, [">= 0"])
91
- s.add_dependency(%q<appraisal>, [">= 0"])
92
- s.add_dependency(%q<simplecov>, [">= 0"])
93
- end
20
+ s.add_runtime_dependency 'activerecord', '>= 2.0.0'
21
+ s.add_development_dependency 'spec'
22
+ s.add_development_dependency 'rspec'
23
+ s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'appraisal'
25
+ s.add_development_dependency 'simplecov'
94
26
  end
95
27
 
@@ -12,7 +12,6 @@ group :development, :test do
12
12
  end
13
13
 
14
14
  group :development do
15
- gem "jeweler"
16
15
  gem "appraisal"
17
16
  gem "simplecov", :require => false
18
17
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -11,7 +11,6 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "jeweler"
15
14
  gem "appraisal"
16
15
  gem "simplecov", :require => false
17
16
  end
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.0.0"
6
+
7
+ group :development, :test do
8
+ gem "spec"
9
+ gem "rspec", ">= 1.2.9"
10
+ gem "rake"
11
+ end
12
+
13
+ group :development do
14
+ gem "appraisal"
15
+ gem "simplecov", :require => false
16
+ end
@@ -23,8 +23,8 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
23
23
  @indexes = Hash.new { |hash, key| hash[key] = [] }
24
24
  @schema_path = config.fetch(:schema){ "db/schema.rb" }
25
25
  @config = config.merge(:adapter => :nulldb)
26
- super(nil, @logger)
27
- @visitor = Arel::Visitors::ToSql.new self if defined?(Arel::Visitors::ToSql)
26
+ super *initialize_args
27
+ @visitor ||= Arel::Visitors::ToSql.new self if defined?(Arel::Visitors::ToSql)
28
28
  end
29
29
 
30
30
  # A log of every statement that has been "executed" by this connection adapter
@@ -121,6 +121,10 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
121
121
  @tables.keys.map(&:to_s)
122
122
  end
123
123
 
124
+ def views
125
+ [] # TODO: Implement properly if needed - This is new method in rails
126
+ end
127
+
124
128
  # Retrieve table columns as defined by the schema
125
129
  def columns(table_name, name = nil)
126
130
  if @tables.size <= 1
@@ -152,7 +156,7 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
152
156
  NullObject.new
153
157
  end
154
158
 
155
- def exec_query(statement, name = 'SQL', binds = [])
159
+ def exec_query(statement, name = 'SQL', binds = [], options = {})
156
160
  self.execution_log << Statement.new(entry_point, statement)
157
161
  EmptyResult.new
158
162
  end
@@ -184,7 +188,7 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
184
188
  end
185
189
  end
186
190
 
187
- def select_all(statement, name=nil, binds = [])
191
+ def select_all(statement, name=nil, binds = [], options = {})
188
192
  with_entry_point(:select_all) do
189
193
  super(statement, name)
190
194
  end
@@ -258,6 +262,8 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
258
262
 
259
263
  def new_table_definition(adapter = nil, table_name = nil, is_temporary = nil, options = {})
260
264
  case ::ActiveRecord::VERSION::MAJOR
265
+ when 5
266
+ TableDefinition.new(table_name, is_temporary, options.except(:id), nil)
261
267
  when 4
262
268
  TableDefinition.new(native_database_types, table_name, is_temporary, options)
263
269
  when 2,3
@@ -273,7 +279,11 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
273
279
 
274
280
  def args_with_optional_cast_type(col_def)
275
281
  default_column_arguments(col_def).tap do |args|
276
- args.insert(2, lookup_cast_type(col_def.type)) if initialize_column_with_cast_type?
282
+ if respond_to? :fetch_type_metadata
283
+ args.insert(2, fetch_type_metadata(col_def.type))
284
+ elsif initialize_column_with_cast_type?
285
+ args.insert(2, lookup_cast_type(col_def.type))
286
+ end
277
287
  end
278
288
  end
279
289
 
@@ -290,4 +300,9 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
290
300
  ::ActiveRecord::VERSION::MAJOR == 4 && ::ActiveRecord::VERSION::MINOR >= 2
291
301
  end
292
302
 
303
+ def initialize_args
304
+ return [nil, @logger, @config] if ActiveRecord::VERSION::MAJOR > 3
305
+ [nil, @logger]
306
+ end
307
+
293
308
  end
@@ -33,7 +33,8 @@ end
33
33
 
34
34
  module ActiveRecord
35
35
  # Just make sure you have the latest version of your schema
36
- class Schema < Migration
36
+ superclass = ActiveRecord::VERSION::MAJOR == 5 ? Migration[5.0] : Migration
37
+ class Schema < superclass
37
38
  def self.define(info={}, &block)
38
39
  instance_eval(&block)
39
40
  end
@@ -77,7 +77,7 @@ describe "NullDB" do
77
77
  t.decimal :salary
78
78
  end
79
79
 
80
- create_table(:employees_widgets, :id => false) do |t|
80
+ create_table(:employees_widgets, :id => false, :force => true) do |t|
81
81
  t.integer :employee_id
82
82
  t.integer :widget_id
83
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-nulldb-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avdi Grimm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-26 00:00:00.000000000 Z
12
+ date: 2016-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -41,20 +41,6 @@ dependencies:
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: 1.2.9
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 1.2.9
56
- - !ruby/object:Gem::Dependency
57
- name: rake
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
46
  - - ">="
@@ -68,7 +54,7 @@ dependencies:
68
54
  - !ruby/object:Gem::Version
69
55
  version: '0'
70
56
  - !ruby/object:Gem::Dependency
71
- name: jeweler
57
+ name: rake
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
60
  - - ">="
@@ -119,6 +105,7 @@ extra_rdoc_files:
119
105
  - LICENSE
120
106
  - README.rdoc
121
107
  files:
108
+ - ".gitignore"
122
109
  - ".travis.yml"
123
110
  - Appraisals
124
111
  - CHANGES.md
@@ -135,6 +122,7 @@ files:
135
122
  - gemfiles/activerecord_4.0.gemfile
136
123
  - gemfiles/activerecord_4.1.gemfile
137
124
  - gemfiles/activerecord_4.2.gemfile
125
+ - gemfiles/activerecord_5.0.gemfile
138
126
  - lib/active_record/connection_adapters/nulldb_adapter.rb
139
127
  - lib/active_record/connection_adapters/nulldb_adapter/checkpoint.rb
140
128
  - lib/active_record/connection_adapters/nulldb_adapter/column.rb
@@ -174,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
162
  - !ruby/object:Gem::Version
175
163
  version: '0'
176
164
  requirements: []
177
- rubyforge_project: nulldb
165
+ rubyforge_project:
178
166
  rubygems_version: 2.4.8
179
167
  signing_key:
180
168
  specification_version: 4