memory_test_fix 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/README.md +5 -5
- data/fixtures/rails42_app/Gemfile +5 -1
- data/fixtures/rails42_app/bin/rake +8 -0
- data/fixtures/rails42_app/bin/spring +15 -0
- data/fixtures/rails42_app/config/application.rb +1 -0
- data/fixtures/rails42_app/config/environments/test.rb +1 -0
- data/fixtures/rails42_app/db/migrate/20140830065127_create_foos.rb +1 -1
- data/fixtures/rails42_app/db/schema.rb +4 -4
- data/lib/memory_test_fix.rb +6 -0
- data/memory_test_fix.gemspec +3 -3
- data/test/integration/integration_test.rb +37 -10
- metadata +9 -20
- data/fixtures/rails32_app/Gemfile +0 -5
- data/fixtures/rails32_app/Rakefile +0 -6
- data/fixtures/rails32_app/app/models/foo.rb +0 -2
- data/fixtures/rails32_app/config/application.rb +0 -14
- data/fixtures/rails32_app/config/boot.rb +0 -6
- data/fixtures/rails32_app/config/environment.rb +0 -5
- data/fixtures/rails32_app/config/environments/test.rb +0 -3
- data/fixtures/rails32_app/db/migrate/20140830065127_create_foos.rb +0 -13
- data/fixtures/rails32_app/db/schema.rb +0 -22
- data/fixtures/rails32_app/script/rails +0 -9
- data/fixtures/rails32_app/test/fixtures/foos.yml +0 -7
- data/fixtures/rails32_app/test/test_helper.rb +0 -13
- data/fixtures/rails32_app/test/unit/foo_test.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 252c0ff8d21e91bac9b707e0bd0ff6ab9ecde051
|
4
|
+
data.tar.gz: c1b83cc9680a2665b5083dbd2e8e860881ed0bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164c1dc344d34eb5e08196dda871bcebdf50ef02f2bd15e9e64ace618694a0d8875775948477b1271381613501a127128404ea7f8030847db724c233a769b0a9
|
7
|
+
data.tar.gz: ce6eb129ccc64d38c679080cafe86381afde8852b8a493db98cf17bfe2d5db7821a2fd7a9352ad11ffdd301d9f4e86a9cf33befd356a457844e43a7dbdafe96c
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -44,11 +44,11 @@ You can also use this with other (testing) environments, not just 'test'.
|
|
44
44
|
|
45
45
|
## Rails Versions
|
46
46
|
|
47
|
-
This gem is compatible with Rails 4
|
48
|
-
|
49
|
-
|
50
|
-
you're using Rails 2.3, use version 0.2.2. If
|
51
|
-
version of Rails, use version 0.1.3.
|
47
|
+
This gem is compatible with Rails 4. If you're using an older version of Rails,
|
48
|
+
your first priority should be upgrading Rails. If that's not an option, you can
|
49
|
+
use version 1.2.2 of this gem with Rails 3.2. If you're using Rails 3.1 or 3.0,
|
50
|
+
use version 1.1.0 of this gem. If you're using Rails 2.3, use version 0.2.2. If
|
51
|
+
you're using an even older version of Rails, use version 0.1.3.
|
52
52
|
|
53
53
|
## Authors
|
54
54
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require "rubygems"
|
8
|
+
require "bundler"
|
9
|
+
|
10
|
+
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
|
11
|
+
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
+
gem "spring", match[1]
|
13
|
+
require "spring/binstub"
|
14
|
+
end
|
15
|
+
end
|
@@ -13,10 +13,10 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20140830065127) do
|
15
15
|
|
16
|
-
create_table "foos", force:
|
17
|
-
t.string "name"
|
18
|
-
t.datetime "created_at"
|
19
|
-
t.datetime "updated_at"
|
16
|
+
create_table "foos", force: :cascade do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.datetime "created_at", null: false
|
19
|
+
t.datetime "updated_at", null: false
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/lib/memory_test_fix.rb
CHANGED
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.
|
3
|
+
spec.version = "1.3.0"
|
4
4
|
|
5
5
|
spec.authors = ["Matijs van Zuijlen",
|
6
6
|
"Chris Roos",
|
@@ -29,8 +29,8 @@ 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", ">=
|
33
|
-
spec.add_runtime_dependency("activerecord", ">=
|
32
|
+
spec.add_runtime_dependency("railties", ">= 4.0.0", "< 4.99.0")
|
33
|
+
spec.add_runtime_dependency("activerecord", ">= 4.0.0", "< 4.99.0")
|
34
34
|
spec.add_development_dependency("rake", "~> 10.2")
|
35
35
|
spec.add_development_dependency("minitest", "~> 5.2")
|
36
36
|
spec.add_development_dependency("rspec", "~> 3.1")
|
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
def in_clean_bundler_environment(*args)
|
5
|
-
system(*%w(/usr/bin/env RUBYOPT
|
5
|
+
system(*%w(/usr/bin/env -u RUBYOPT -u BUNDLE_BIN_PATH -u BUNDLE_GEMFILE) + args)
|
6
6
|
end
|
7
7
|
|
8
8
|
def update_bundle(label)
|
@@ -12,10 +12,10 @@ def update_bundle(label)
|
|
12
12
|
raise "Unable to initialize test environment for #{label}"
|
13
13
|
end
|
14
14
|
|
15
|
-
def run_tests
|
15
|
+
def run_tests(command_array = %w(bundle exec rake))
|
16
16
|
result = false
|
17
17
|
out, err = capture_subprocess_io do
|
18
|
-
result = in_clean_bundler_environment(
|
18
|
+
result = in_clean_bundler_environment(*command_array)
|
19
19
|
end
|
20
20
|
# If the command failed, make it print any error messages
|
21
21
|
err.must_equal "" unless result
|
@@ -35,6 +35,10 @@ BASE_CONFIG = {
|
|
35
35
|
}
|
36
36
|
}
|
37
37
|
|
38
|
+
MIGRATING_CONFIG = BASE_CONFIG.dup.tap do |config|
|
39
|
+
config["test"] = config["test"].merge("migrate" => true)
|
40
|
+
end
|
41
|
+
|
38
42
|
def create_db_config_without_migrations
|
39
43
|
File.open 'config/database.yml', 'w' do |f|
|
40
44
|
f.puts YAML.dump(BASE_CONFIG)
|
@@ -43,24 +47,23 @@ end
|
|
43
47
|
|
44
48
|
def create_db_config_with_migrations
|
45
49
|
File.open 'config/database.yml', 'w' do |f|
|
46
|
-
f.puts YAML.dump
|
50
|
+
f.puts YAML.dump(MIGRATING_CONFIG)
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
54
|
VERSIONS = [
|
51
|
-
["Rails
|
52
|
-
["Rails 4.
|
53
|
-
["Rails 4.
|
54
|
-
["Rails 4.2", 'rails42_app'],
|
55
|
+
["Rails 4.0", 'rails40_app', false],
|
56
|
+
["Rails 4.1", 'rails41_app', false],
|
57
|
+
["Rails 4.2", 'rails42_app', true],
|
55
58
|
]
|
56
59
|
|
57
|
-
VERSIONS.each do |label, appdir|
|
60
|
+
VERSIONS.each do |label, appdir, binstubs|
|
58
61
|
Dir.chdir "fixtures/#{appdir}" do
|
59
62
|
update_bundle label
|
60
63
|
end
|
61
64
|
|
62
65
|
describe "A #{label} app using memory_test_fix" do
|
63
|
-
it "can run its tests without
|
66
|
+
it "can run its tests in-memory without migrations" do
|
64
67
|
Dir.chdir "fixtures/#{appdir}" do
|
65
68
|
create_db_config_without_migrations
|
66
69
|
out = run_tests
|
@@ -74,6 +77,30 @@ VERSIONS.each do |label, appdir|
|
|
74
77
|
create_db_config_with_migrations
|
75
78
|
out = run_tests
|
76
79
|
out.must_match(/Creating sqlite :memory: database/)
|
80
|
+
out.wont_match(/initialize_schema_migrations_table/)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if binstubs
|
85
|
+
describe 'when using spring' do
|
86
|
+
let(:command_array) { %w(bin/rake) }
|
87
|
+
it "can run its tests in-memory without migrations" do
|
88
|
+
Dir.chdir "fixtures/#{appdir}" do
|
89
|
+
create_db_config_without_migrations
|
90
|
+
out = run_tests command_array
|
91
|
+
out.must_match(/Creating sqlite :memory: database/)
|
92
|
+
out.must_match(/initialize_schema_migrations_table/)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can run its tests in-memory with migrations" do
|
97
|
+
Dir.chdir "fixtures/#{appdir}" do
|
98
|
+
create_db_config_with_migrations
|
99
|
+
out = run_tests command_array
|
100
|
+
out.must_match(/Creating sqlite :memory: database/)
|
101
|
+
out.wont_match(/initialize_schema_migrations_table/)
|
102
|
+
end
|
103
|
+
end
|
77
104
|
end
|
78
105
|
end
|
79
106
|
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.
|
4
|
+
version: 1.3.0
|
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:
|
17
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: railties
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
25
|
+
version: 4.0.0
|
26
26
|
- - "<"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 4.99.0
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 4.0.0
|
36
36
|
- - "<"
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: 4.99.0
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 4.0.0
|
46
46
|
- - "<"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 4.99.0
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 4.0.0
|
56
56
|
- - "<"
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 4.99.0
|
@@ -111,19 +111,6 @@ files:
|
|
111
111
|
- Gemfile
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
|
-
- fixtures/rails32_app/Gemfile
|
115
|
-
- fixtures/rails32_app/Rakefile
|
116
|
-
- fixtures/rails32_app/app/models/foo.rb
|
117
|
-
- fixtures/rails32_app/config/application.rb
|
118
|
-
- fixtures/rails32_app/config/boot.rb
|
119
|
-
- fixtures/rails32_app/config/environment.rb
|
120
|
-
- fixtures/rails32_app/config/environments/test.rb
|
121
|
-
- fixtures/rails32_app/db/migrate/20140830065127_create_foos.rb
|
122
|
-
- fixtures/rails32_app/db/schema.rb
|
123
|
-
- fixtures/rails32_app/script/rails
|
124
|
-
- fixtures/rails32_app/test/fixtures/foos.yml
|
125
|
-
- fixtures/rails32_app/test/test_helper.rb
|
126
|
-
- fixtures/rails32_app/test/unit/foo_test.rb
|
127
114
|
- fixtures/rails40_app/Gemfile
|
128
115
|
- fixtures/rails40_app/Rakefile
|
129
116
|
- fixtures/rails40_app/app/models/foo.rb
|
@@ -154,6 +141,8 @@ files:
|
|
154
141
|
- fixtures/rails42_app/Gemfile
|
155
142
|
- fixtures/rails42_app/Rakefile
|
156
143
|
- fixtures/rails42_app/app/models/foo.rb
|
144
|
+
- fixtures/rails42_app/bin/rake
|
145
|
+
- fixtures/rails42_app/bin/spring
|
157
146
|
- fixtures/rails42_app/config/application.rb
|
158
147
|
- fixtures/rails42_app/config/boot.rb
|
159
148
|
- fixtures/rails42_app/config/environment.rb
|
@@ -197,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
186
|
version: '0'
|
198
187
|
requirements: []
|
199
188
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.4.5.1
|
201
190
|
signing_key:
|
202
191
|
specification_version: 4
|
203
192
|
summary: Use SQLite3 in-memory database for Rails tests.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails'
|
4
|
-
require 'active_record/railtie'
|
5
|
-
require 'rails/test_unit/railtie'
|
6
|
-
|
7
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
-
|
9
|
-
module Rails32App
|
10
|
-
class Application < Rails::Application
|
11
|
-
config.encoding = "utf-8"
|
12
|
-
config.filter_parameters += [:password, :ssn]
|
13
|
-
end
|
14
|
-
end
|
@@ -1,22 +0,0 @@
|
|
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 to 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"
|
18
|
-
t.datetime "created_at", :null => false
|
19
|
-
t.datetime "updated_at", :null => false
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
-
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
-
|
8
|
-
require BOOT_PATH
|
9
|
-
require 'rails/commands'
|
@@ -1,13 +0,0 @@
|
|
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|csv) for all tests in alphabetical order.
|
7
|
-
#
|
8
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
-
# -- they do not yet inherit this setting
|
10
|
-
fixtures :all
|
11
|
-
|
12
|
-
# Add more helper methods to be used by all tests here...
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
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
|