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 +4 -4
- data/.gitignore +28 -0
- data/.travis.yml +13 -0
- data/Appraisals +4 -0
- data/CHANGES.md +5 -0
- data/Gemfile +0 -1
- data/README.rdoc +3 -3
- data/Rakefile +1 -22
- data/activerecord-nulldb-adapter.gemspec +10 -78
- data/gemfiles/activerecord_2.3.gemfile +0 -1
- data/gemfiles/activerecord_3.0.gemfile +0 -1
- data/gemfiles/activerecord_3.1.gemfile +0 -1
- data/gemfiles/activerecord_3.2.gemfile +0 -1
- data/gemfiles/activerecord_4.0.gemfile +0 -1
- data/gemfiles/activerecord_4.1.gemfile +0 -1
- data/gemfiles/activerecord_4.2.gemfile +0 -1
- data/gemfiles/activerecord_5.0.gemfile +16 -0
- data/lib/active_record/connection_adapters/nulldb_adapter/core.rb +20 -5
- data/lib/nulldb/extensions.rb +2 -1
- data/spec/nulldb_spec.rb +1 -1
- metadata +6 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a2b38931986ca22035d58a578fa13a21f74360
|
4
|
+
data.tar.gz: 5700dffe9b6c19f8ff9c9e0b8cb3c81887c9dde1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace3f7f82325a86cb9744fa365f740ab9317961f724412d07dfc0b8f6e83948a8b98375a228ab9721a230466908f1ed4440c268edfc555be3fd7081c0c119890
|
7
|
+
data.tar.gz: 745b6c3543a7e59563cfbf78edf65345e248641d5b7e9fb90389686ee0375718ca523dc52e4db39a2a12a420a9d1e2829ed2a32242fea5e7f3038cec91f09d84
|
data/.gitignore
ADDED
@@ -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
|
data/.travis.yml
CHANGED
@@ -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
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -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
|
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
|
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
|
-
|
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
|
-
#
|
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
|
+
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.
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
|
@@ -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
|
27
|
-
@visitor
|
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
|
-
|
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
|
data/lib/nulldb/extensions.rb
CHANGED
@@ -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
|
-
|
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
|
data/spec/nulldb_spec.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
165
|
+
rubyforge_project:
|
178
166
|
rubygems_version: 2.4.8
|
179
167
|
signing_key:
|
180
168
|
specification_version: 4
|