memory_test_fix 1.5.0 → 1.5.1

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
  SHA256:
3
- metadata.gz: dbbaf46755ac3025b3caa67313dfdd3f84e749faedd7e381fa21c12d7a1202da
4
- data.tar.gz: 5265b0c883df03deb39a391713a1f085c2edb33c406c9d5ed1516b614db3198b
3
+ metadata.gz: b7b24810e0c8880d8ad864f5300722d79486e460ed6c1d2d9ad0156d65b3057e
4
+ data.tar.gz: 3aa965eecb3bb172bb352c2638ed5be9dee440a61c6590e806f90837e7ca9d7f
5
5
  SHA512:
6
- metadata.gz: 8f95e587b55511535076f7edb1a061b9b0cd287cd04d315604e53601ff77c54519dd1c6f26c21fd2ac326ddcf523a40e9c8efd29ec6c76d0972c2a9cc83dac35
7
- data.tar.gz: 5e9d1c624e2852dbb8f387de415061bbca5635bad6b9dc0d5f263b170b243683520d27cc61540a986c6f886ffa035d84809e265e2a6197af6bbfcd27597c5ed4
6
+ metadata.gz: 012e71481dabdd56e456d2f1620715ab681083ff0329ff0d7a647b8f6adc22601ed14f45c9776685447b49b39400e350f10701f8bc4f49018d20ba3a01f54c8b
7
+ data.tar.gz: f4e428be5627a989ffd99935e92788884f41aee0ccc015114e12b0f14a11a1a2f0f274a37ff56535f0d8d760739bff7164043ef5bdfd02dcf93757ae1a5d8d3d
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.1 / 2018-02-14
4
+
5
+ * Fix support for Rails 5.2: Handle Rails 5.2's repeated connection
6
+ establishment.
7
+
3
8
  ## 1.5.0 / 2018-02-14
4
9
 
5
10
  * Add support for Rails 5.2
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -11,10 +10,10 @@
11
10
  #
12
11
  # It's strongly recommended that you check this file into your version control system.
13
12
 
14
- ActiveRecord::Schema.define(version: 20140830065127) do
13
+ ActiveRecord::Schema.define(version: 2014_08_30_065127) do
15
14
 
16
15
  create_table "foos", force: :cascade do |t|
17
- t.string "name"
16
+ t.string "name"
18
17
  t.datetime "created_at", null: false
19
18
  t.datetime "updated_at", null: false
20
19
  end
@@ -3,7 +3,7 @@ require 'memory_test_fix/schema_loader'
3
3
  if defined?(Rails)
4
4
  require 'memory_test_fix/railtie.rb'
5
5
 
6
- if Rails.version =~ /^4\.0\./
6
+ if Rails.version =~ /^5\.2\./
7
7
  ActiveRecord::Base.class_eval do
8
8
  def self.establish_connection(*_)
9
9
  super.tap do
@@ -4,7 +4,6 @@ module MemoryTestFix
4
4
  module SchemaFileLoader
5
5
  # Load the Rails schema file.
6
6
  def self.load_schema
7
- # TODO: Use tooling provided by rails once support for Rails 3 is dropped.
8
7
  load "#{Rails.root}/db/schema.rb"
9
8
  end
10
9
  end
@@ -56,11 +56,11 @@ module MemoryTestFix
56
56
  end
57
57
 
58
58
  def silent?
59
- verbosity == "silent"
59
+ verbosity == 'silent'
60
60
  end
61
61
 
62
62
  def quiet?
63
- verbosity == "quiet"
63
+ verbosity == 'quiet'
64
64
  end
65
65
 
66
66
  def migrate
@@ -68,7 +68,7 @@ module MemoryTestFix
68
68
  end
69
69
 
70
70
  def inform_using_in_memory
71
- puts "Creating sqlite :memory: database"
71
+ puts 'Creating sqlite :memory: database'
72
72
  end
73
73
 
74
74
  def load_schema
@@ -1,38 +1,38 @@
1
1
  Gem::Specification.new do |spec|
2
- spec.name = "memory_test_fix"
3
- spec.version = "1.5.0"
2
+ spec.name = 'memory_test_fix'
3
+ spec.version = '1.5.1'
4
4
 
5
- spec.authors = ["Matijs van Zuijlen",
6
- "Chris Roos",
7
- "Geoffrey Grosenbach",
8
- "Kakutani Shintaro",
9
- "Erik Hanson and Matt Scilipoti",
10
- "Greg Weber",
11
- "Stephan Zalewski"]
12
- spec.email = "matijs@matijs.net"
13
- spec.homepage = "http://wiki.github.com/mvz/memory_test_fix"
5
+ spec.authors = ['Matijs van Zuijlen',
6
+ 'Chris Roos',
7
+ 'Geoffrey Grosenbach',
8
+ 'Kakutani Shintaro',
9
+ 'Erik Hanson and Matt Scilipoti',
10
+ 'Greg Weber',
11
+ 'Stephan Zalewski']
12
+ spec.email = 'matijs@matijs.net'
13
+ spec.homepage = 'http://wiki.github.com/mvz/memory_test_fix'
14
14
 
15
- spec.license = "MIT"
15
+ spec.license = 'MIT'
16
16
 
17
- spec.summary = "Use SQLite3 in-memory database for Rails tests."
17
+ spec.summary = 'Use SQLite3 in-memory database for Rails tests.'
18
18
  spec.description = <<-TEXT
19
19
  Makes use of SQLite3 in-memory database possible for your
20
20
  Rails tests by preloading the schema.
21
21
  TEXT
22
22
  spec.required_ruby_version = '>= 2.2.0'
23
23
 
24
- spec.files = Dir["{lib,test,spec,fixtures}/**/*",
25
- "*.md",
26
- "*.gemspec",
27
- "Rakefile",
28
- "Gemfile"] & `git ls-files -z`.split("\0")
24
+ spec.files = Dir['{lib,test,spec,fixtures}/**/*',
25
+ '*.md',
26
+ '*.gemspec',
27
+ 'Rakefile',
28
+ 'Gemfile'] & `git ls-files -z`.split("\0")
29
29
 
30
- spec.rdoc_options = ["--main", "README.md"]
31
- spec.extra_rdoc_files = ["README.md"]
30
+ spec.rdoc_options = ['--main', 'README.md']
31
+ spec.extra_rdoc_files = ['README.md']
32
32
 
33
- spec.add_runtime_dependency("activerecord", "~> 5.0")
34
- spec.add_runtime_dependency("railties", "~> 5.0")
35
- spec.add_development_dependency("minitest", "~> 5.2")
36
- spec.add_development_dependency("rake", "~> 12.0")
37
- spec.add_development_dependency("rspec", "~> 3.1")
33
+ spec.add_runtime_dependency('activerecord', '~> 5.0')
34
+ spec.add_runtime_dependency('railties', '~> 5.0')
35
+ spec.add_development_dependency('minitest', '~> 5.2')
36
+ spec.add_development_dependency('rake', '~> 12.0')
37
+ spec.add_development_dependency('rspec', '~> 3.1')
38
38
  end
@@ -29,11 +29,11 @@ RSpec.describe MemoryTestFix::SchemaLoader do
29
29
  context 'when no in-memory database is configured' do
30
30
  let(:config) { { database: 'some/file.sqlite3', adapter: 'sqlite3' } }
31
31
 
32
- it "outputs nothing" do
32
+ it 'outputs nothing' do
33
33
  expect { schema_loader.init_schema }.not_to output.to_stdout
34
34
  end
35
35
 
36
- it "does not load anything" do
36
+ it 'does not load anything' do
37
37
  schema_loader.init_schema
38
38
  expect(loader).not_to have_received :load_schema
39
39
  end
@@ -42,26 +42,26 @@ RSpec.describe MemoryTestFix::SchemaLoader do
42
42
  context 'when configured not to use migrations' do
43
43
  let(:config) { base_config }
44
44
 
45
- it "informs the user it is creating an in-memory database" do
45
+ it 'informs the user it is creating an in-memory database' do
46
46
  expect { schema_loader.init_schema }.
47
47
  to output(/Creating sqlite :memory: database/).to_stdout
48
48
  end
49
49
 
50
- it "prints the output from the loader" do
50
+ it 'prints the output from the loader' do
51
51
  expect { schema_loader.init_schema }.
52
52
  to output(/loading schema/).to_stdout
53
53
  end
54
54
 
55
- it "tells the loader to load the schema" do
55
+ it 'tells the loader to load the schema' do
56
56
  silently { schema_loader.init_schema }
57
57
  expect(loader).to have_received :load_schema
58
58
  end
59
59
  end
60
60
 
61
- context "when configured to use migrations" do
61
+ context 'when configured to use migrations' do
62
62
  let(:config) { base_config.merge(migrate: true) }
63
63
 
64
- it "informs the user it is creating an in-memory database" do
64
+ it 'informs the user it is creating an in-memory database' do
65
65
  expect { schema_loader.init_schema }.
66
66
  to output(/Creating sqlite :memory: database/).to_stdout
67
67
  end
@@ -71,30 +71,30 @@ RSpec.describe MemoryTestFix::SchemaLoader do
71
71
  not_to output(/loading schema/).to_stdout
72
72
  end
73
73
 
74
- it "tells the migrator to run the migrations" do
74
+ it 'tells the migrator to run the migrations' do
75
75
  silently { schema_loader.init_schema }
76
76
  expect(migrator).to have_received :up
77
77
  end
78
78
  end
79
79
 
80
- context "when running in quietly" do
80
+ context 'when running in quietly' do
81
81
  let(:config) { base_config.merge(verbosity: 'quiet') }
82
82
 
83
- it "informs the user it is creating an in-memory database" do
83
+ it 'informs the user it is creating an in-memory database' do
84
84
  expect { schema_loader.init_schema }.
85
85
  to output(/Creating sqlite :memory: database/).to_stdout
86
86
  end
87
87
 
88
- it "does not print the output from the loader" do
88
+ it 'does not print the output from the loader' do
89
89
  expect { schema_loader.init_schema }.
90
90
  not_to output(/loading schema/).to_stdout
91
91
  end
92
92
  end
93
93
 
94
- context "when running in silence" do
94
+ context 'when running in silence' do
95
95
  let(:config) { base_config.merge(verbosity: 'silent') }
96
96
 
97
- it "outputs nothing" do
97
+ it 'outputs nothing' do
98
98
  expect { schema_loader.init_schema }.not_to output.to_stdout
99
99
  end
100
100
  end
@@ -18,7 +18,7 @@ def run_tests(command_array = %w(bundle exec rake))
18
18
  result = in_clean_bundler_environment(*command_array)
19
19
  end
20
20
  # If the command failed, make it print any error messages
21
- err.must_equal "" unless result
21
+ err.must_equal '' unless result
22
22
  out
23
23
  end
24
24
 
@@ -29,20 +29,20 @@ def stop_spring
29
29
  end
30
30
 
31
31
  BASE_CONFIG = {
32
- "development" => {
33
- "adapter" => 'sqlite3',
34
- "pool" => 5,
35
- "timeout" => 5000,
36
- "database" => 'db/development.sqlite3'
32
+ 'development' => {
33
+ 'adapter' => 'sqlite3',
34
+ 'pool' => 5,
35
+ 'timeout' => 5000,
36
+ 'database' => 'db/development.sqlite3'
37
37
  },
38
- "test" => {
39
- "adapter" => 'sqlite3',
40
- "database" => ':memory:'
38
+ 'test' => {
39
+ 'adapter' => 'sqlite3',
40
+ 'database' => ':memory:'
41
41
  }
42
42
  }.freeze
43
43
 
44
44
  MIGRATING_CONFIG = BASE_CONFIG.dup.tap do |config|
45
- config["test"] = config["test"].merge("migrate" => true)
45
+ config['test'] = config['test'].merge('migrate' => true)
46
46
  end
47
47
 
48
48
  def create_db_config_without_migrations
@@ -58,9 +58,9 @@ def create_db_config_with_migrations
58
58
  end
59
59
 
60
60
  VERSIONS = [
61
- ["Rails 5.0", 'rails50_app'],
62
- ["Rails 5.1", 'rails51_app'],
63
- ["Rails 5.2", 'rails52_app'],
61
+ ['Rails 5.0', 'rails50_app'],
62
+ ['Rails 5.1', 'rails51_app'],
63
+ ['Rails 5.2', 'rails52_app']
64
64
  ].freeze
65
65
 
66
66
  VERSIONS.each do |label, appdir|
@@ -69,43 +69,47 @@ VERSIONS.each do |label, appdir|
69
69
  end
70
70
 
71
71
  describe "A #{label} app using memory_test_fix" do
72
- it "can run its tests in-memory without migrations" do
72
+ it 'can run its tests in-memory without migrations' do
73
73
  Dir.chdir "fixtures/#{appdir}" do
74
74
  create_db_config_without_migrations
75
75
  out = run_tests
76
76
  out.must_match(/Creating sqlite :memory: database/)
77
77
  out.wont_match(/migrating/)
78
+ out.must_match(/2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/)
78
79
  end
79
80
  end
80
81
 
81
- it "can run its tests in-memory with migrations" do
82
+ it 'can run its tests in-memory with migrations' do
82
83
  Dir.chdir "fixtures/#{appdir}" do
83
84
  create_db_config_with_migrations
84
85
  out = run_tests
85
86
  out.must_match(/Creating sqlite :memory: database/)
86
87
  out.must_match(/migrating/)
88
+ out.must_match(/2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/)
87
89
  end
88
90
  end
89
91
 
90
92
  describe 'when using spring' do
91
93
  let(:command_array) { %w(bin/rake) }
92
- it "can run its tests in-memory without migrations" do
94
+ it 'can run its tests in-memory without migrations' do
93
95
  Dir.chdir "fixtures/#{appdir}" do
94
96
  stop_spring
95
97
  create_db_config_without_migrations
96
98
  out = run_tests command_array
97
99
  out.must_match(/Creating sqlite :memory: database/)
98
100
  out.wont_match(/migrating/)
101
+ out.must_match(/2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/)
99
102
  end
100
103
  end
101
104
 
102
- it "can run its tests in-memory with migrations" do
105
+ it 'can run its tests in-memory with migrations' do
103
106
  Dir.chdir "fixtures/#{appdir}" do
104
107
  stop_spring
105
108
  create_db_config_with_migrations
106
109
  out = run_tests command_array
107
110
  out.must_match(/Creating sqlite :memory: database/)
108
111
  out.must_match(/migrating/)
112
+ out.must_match(/2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/)
109
113
  end
110
114
  end
111
115
  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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen