memory_test_fix 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/README.md +4 -6
- data/fixtures/rails42_app/Gemfile +5 -0
- data/fixtures/rails42_app/Rakefile +6 -0
- data/fixtures/rails42_app/app/models/foo.rb +2 -0
- data/fixtures/rails42_app/config/application.rb +12 -0
- data/fixtures/rails42_app/config/boot.rb +3 -0
- data/fixtures/rails42_app/config/environment.rb +5 -0
- data/fixtures/rails42_app/config/environments/development.rb +3 -0
- data/fixtures/rails42_app/config/environments/production.rb +3 -0
- data/fixtures/rails42_app/config/environments/test.rb +4 -0
- data/fixtures/rails42_app/config/initializers/filter_parameter_logging.rb +1 -0
- data/fixtures/rails42_app/db/migrate/20140830065127_create_foos.rb +13 -0
- data/fixtures/rails42_app/db/schema.rb +22 -0
- data/fixtures/rails42_app/test/fixtures/foos.yml +7 -0
- data/fixtures/rails42_app/test/test_helper.rb +10 -0
- data/fixtures/rails42_app/test/unit/foo_test.rb +13 -0
- data/lib/memory_test_fix/schema_file_loader.rb +2 -0
- data/lib/memory_test_fix/schema_loader.rb +11 -0
- data/memory_test_fix.gemspec +4 -4
- data/test/integration/integration_test.rb +1 -0
- metadata +35 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9edd3156a490243468c8f7cc900f0f78ef05cbe4
|
4
|
+
data.tar.gz: 0ca43175ce12f05cc8ade8c63eebf4a496acc44f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0490f360784f09d80c3276ba47696011ec4b894bcf297e03a493bba0fd9c8c4a7bd4478e348d165389eb4e2b7d5cd7fa0fbf082a38e7f5f9d82bce9f8c40df9d
|
7
|
+
data.tar.gz: fd54cfd80904a988b68b5ef0421cc90f163d70f8c558e9308a30c4d18f53f59f5194e52a46d0666cd97d818734eb42f55b968e58eabcec8d9798ac470e0b080a
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -35,12 +35,10 @@ You can also adjust the verbosity of the output:
|
|
35
35
|
|
36
36
|
To use rails migrations instead of loading `db/schema.rb`
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
migrate: true
|
43
|
-
```
|
38
|
+
test:
|
39
|
+
adapter: sqlite3
|
40
|
+
database: ":memory:"
|
41
|
+
migrate: true
|
44
42
|
|
45
43
|
You can also use this with other (testing) environments, not just 'test'.
|
46
44
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.filter_parameters += [:password]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20140830065127) do
|
15
|
+
|
16
|
+
create_table "foos", force: true do |t|
|
17
|
+
t.string "name", limit: 255
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
ENV['RAILS_ENV'] ||= 'test'
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
7
|
+
fixtures :all
|
8
|
+
|
9
|
+
# Add more helper methods to be used by all tests here...
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FooTest < ActiveSupport::TestCase
|
4
|
+
test "Foos have names" do
|
5
|
+
assert_equal 'Foo one', foos(:one).name
|
6
|
+
end
|
7
|
+
|
8
|
+
test "Foos can be stored" do
|
9
|
+
foo = Foo.new(name: 'A third')
|
10
|
+
foo.save!
|
11
|
+
assert_equal 'A third', Foo.find(foo.id).name
|
12
|
+
end
|
13
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module MemoryTestFix
|
2
2
|
# Load Rails schema file into in-memory database.
|
3
|
+
# @api private
|
3
4
|
module SchemaFileLoader
|
5
|
+
# Load the Rails schema file.
|
4
6
|
def self.load_schema
|
5
7
|
# TODO: Use tooling provided by rails once support for Rails 3 is dropped.
|
6
8
|
load "#{Rails.root}/db/schema.rb"
|
@@ -4,16 +4,27 @@ require 'active_support/core_ext/kernel/reporting'
|
|
4
4
|
module MemoryTestFix
|
5
5
|
# Set up database schema into in-memory database.
|
6
6
|
class SchemaLoader
|
7
|
+
# Initialize the schema for an in-memory database, if it is configured. See
|
8
|
+
# the README for details on how to configure Rails to use an in-memory
|
9
|
+
# database.
|
7
10
|
def self.init_schema
|
8
11
|
new.init_schema
|
9
12
|
end
|
10
13
|
|
14
|
+
# @param [Hash] options The options to configure this instance of SchemaLoader with.
|
15
|
+
# @option options [Hash] :configuration The configuration of the database connection
|
16
|
+
# @option options :migrator The migrator to use if configured to use migrations
|
17
|
+
# @option options :loader The loader to use if configured to not use migrations
|
18
|
+
# @api private
|
11
19
|
def initialize(options = {})
|
12
20
|
@configuration = options[:configuration] || ActiveRecord::Base.connection_config
|
13
21
|
@migrator = options[:migrator] || ActiveRecord::Migrator
|
14
22
|
@loader = options[:loader] || SchemaFileLoader
|
15
23
|
end
|
16
24
|
|
25
|
+
# Initialize the schema for the in-memoray database according to the
|
26
|
+
# configuration passed to the constructor.
|
27
|
+
# @api private
|
17
28
|
def init_schema
|
18
29
|
return unless in_memory_database?
|
19
30
|
|
data/memory_test_fix.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "memory_test_fix"
|
3
|
-
spec.version = "1.2.
|
3
|
+
spec.version = "1.2.2"
|
4
4
|
|
5
5
|
spec.authors = ["Matijs van Zuijlen",
|
6
6
|
"Chris Roos",
|
@@ -29,9 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.rdoc_options = ["--main", "README.md"]
|
30
30
|
spec.extra_rdoc_files = ["README.md"]
|
31
31
|
|
32
|
-
spec.add_runtime_dependency("railties", ">= 3.0.0")
|
33
|
-
spec.add_runtime_dependency("activerecord", ">= 3.0.0")
|
32
|
+
spec.add_runtime_dependency("railties", ">= 3.2.0", "< 4.99.0")
|
33
|
+
spec.add_runtime_dependency("activerecord", ">= 3.2.0", "< 4.99.0")
|
34
34
|
spec.add_development_dependency("rake", "~> 10.2")
|
35
35
|
spec.add_development_dependency("minitest", "~> 5.2")
|
36
|
-
spec.add_development_dependency("rspec", "~> 3.1
|
36
|
+
spec.add_development_dependency("rspec", "~> 3.1")
|
37
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memory_test_fix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2014-09-
|
17
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: railties
|
@@ -22,28 +22,40 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 3.
|
25
|
+
version: 3.2.0
|
26
|
+
- - "<"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 4.99.0
|
26
29
|
type: :runtime
|
27
30
|
prerelease: false
|
28
31
|
version_requirements: !ruby/object:Gem::Requirement
|
29
32
|
requirements:
|
30
33
|
- - ">="
|
31
34
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
35
|
+
version: 3.2.0
|
36
|
+
- - "<"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 4.99.0
|
33
39
|
- !ruby/object:Gem::Dependency
|
34
40
|
name: activerecord
|
35
41
|
requirement: !ruby/object:Gem::Requirement
|
36
42
|
requirements:
|
37
43
|
- - ">="
|
38
44
|
- !ruby/object:Gem::Version
|
39
|
-
version: 3.
|
45
|
+
version: 3.2.0
|
46
|
+
- - "<"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 4.99.0
|
40
49
|
type: :runtime
|
41
50
|
prerelease: false
|
42
51
|
version_requirements: !ruby/object:Gem::Requirement
|
43
52
|
requirements:
|
44
53
|
- - ">="
|
45
54
|
- !ruby/object:Gem::Version
|
46
|
-
version: 3.
|
55
|
+
version: 3.2.0
|
56
|
+
- - "<"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 4.99.0
|
47
59
|
- !ruby/object:Gem::Dependency
|
48
60
|
name: rake
|
49
61
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +90,14 @@ dependencies:
|
|
78
90
|
requirements:
|
79
91
|
- - "~>"
|
80
92
|
- !ruby/object:Gem::Version
|
81
|
-
version: 3.1
|
93
|
+
version: '3.1'
|
82
94
|
type: :development
|
83
95
|
prerelease: false
|
84
96
|
version_requirements: !ruby/object:Gem::Requirement
|
85
97
|
requirements:
|
86
98
|
- - "~>"
|
87
99
|
- !ruby/object:Gem::Version
|
88
|
-
version: 3.1
|
100
|
+
version: '3.1'
|
89
101
|
description: |2
|
90
102
|
Makes use of SQLite3 in-memory database possible for your
|
91
103
|
Rails tests by preloading the schema.
|
@@ -139,6 +151,21 @@ files:
|
|
139
151
|
- fixtures/rails41_app/test/fixtures/foos.yml
|
140
152
|
- fixtures/rails41_app/test/test_helper.rb
|
141
153
|
- fixtures/rails41_app/test/unit/foo_test.rb
|
154
|
+
- fixtures/rails42_app/Gemfile
|
155
|
+
- fixtures/rails42_app/Rakefile
|
156
|
+
- fixtures/rails42_app/app/models/foo.rb
|
157
|
+
- fixtures/rails42_app/config/application.rb
|
158
|
+
- fixtures/rails42_app/config/boot.rb
|
159
|
+
- fixtures/rails42_app/config/environment.rb
|
160
|
+
- fixtures/rails42_app/config/environments/development.rb
|
161
|
+
- fixtures/rails42_app/config/environments/production.rb
|
162
|
+
- fixtures/rails42_app/config/environments/test.rb
|
163
|
+
- fixtures/rails42_app/config/initializers/filter_parameter_logging.rb
|
164
|
+
- fixtures/rails42_app/db/migrate/20140830065127_create_foos.rb
|
165
|
+
- fixtures/rails42_app/db/schema.rb
|
166
|
+
- fixtures/rails42_app/test/fixtures/foos.yml
|
167
|
+
- fixtures/rails42_app/test/test_helper.rb
|
168
|
+
- fixtures/rails42_app/test/unit/foo_test.rb
|
142
169
|
- lib/memory_test_fix.rb
|
143
170
|
- lib/memory_test_fix/railtie.rb
|
144
171
|
- lib/memory_test_fix/schema_file_loader.rb
|