storey 2.1.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 077fb1249a3bf984d1613b1351468cebf881bde2ac2e4f299d3b9d17a877d0e5
4
- data.tar.gz: 38f7315acb1dcb9c3545a64dca60e67105d6b8520cd276ae1dec8997b4028ec7
3
+ metadata.gz: fe9182b67b4f2738c91562f6366b59c15f7c5db272cdc32fd837ec1159cc753a
4
+ data.tar.gz: b61703b7b12878c85a3a9fbcf1cd0af5208c612f153ce8f25e8e7fe70aef6053
5
5
  SHA512:
6
- metadata.gz: 3d5cc746a06923f49fe9226c8183aaf9a68293a6639a24108fc3b161ab15bf78342bf7124ffa1ac9ded5f4055b75d01be1f815cb67cae65013b6ce12d41b32e6
7
- data.tar.gz: 1418cbe848c0e891c5e7c70f05ac5384b79946b9cc878b1e92e918032fbfa36cef8a5209fe89c0a3dcbcea19262cd0a4aea9fcec9e5a3d60d156e2ba36401784
6
+ metadata.gz: 75fc2bdc24f43a52a7376fcd4db66484c0e53d01f06f6a65002d3a3eaa2f997867153d572dc1d032e2992979a76ba6d3d14e1234e8f3ec8fa65eeed040dd834a
7
+ data.tar.gz: 67d233bff3fdb58629cc15d5cc244182514e5810a23a5c5607a1b230714eb759425b113bbce776fe1eaaff5f0dd6c3b9fdcdc41d34d91524f945497324d494a3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [2.1.2] - 2018-08-14
6
+ ### Fixed
7
+ - Instances when queries are cached between switches
8
+
5
9
  ## [2.1.1] - 2018-07-04
6
10
  ### Fixed
7
11
  - Fix copying of schemas in when ActiveRecord caches queries
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- storey (2.1.1)
4
+ storey (2.1.2)
5
5
  easy_class_to_instance_method (~> 0.0.2)
6
6
  gem_config
7
7
  pg
@@ -153,4 +153,4 @@ DEPENDENCIES
153
153
  storey!
154
154
 
155
155
  BUNDLED WITH
156
- 1.16.2
156
+ 1.16.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- storey (2.1.1)
4
+ storey (2.1.2)
5
5
  easy_class_to_instance_method (~> 0.0.2)
6
6
  gem_config
7
7
  pg
@@ -152,4 +152,4 @@ DEPENDENCIES
152
152
  storey!
153
153
 
154
154
  BUNDLED WITH
155
- 1.16.2
155
+ 1.16.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- storey (2.1.1)
4
+ storey (2.1.2)
5
5
  easy_class_to_instance_method (~> 0.0.2)
6
6
  gem_config
7
7
  pg
@@ -160,4 +160,4 @@ DEPENDENCIES
160
160
  storey!
161
161
 
162
162
  BUNDLED WITH
163
- 1.16.2
163
+ 1.16.3
data/lib/storey.rb CHANGED
@@ -150,6 +150,7 @@ module Storey
150
150
  switch original_schema
151
151
  result
152
152
  else
153
+ ::ActiveRecord::Base.connection.query_cache.clear
153
154
  reset and return if name.blank? || name == 'public'
154
155
  path = self.schema_search_path_for(name)
155
156
 
@@ -1,3 +1,3 @@
1
1
  module Storey
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
@@ -25,6 +25,18 @@ RSpec.describe Storey do
25
25
 
26
26
  Storey.switch("s1") { expect(Post.count).to eq 2 }
27
27
  Storey.switch("s2") { expect(Post.count).to eq 3 }
28
+
29
+ Storey.switch("s1")
30
+ expect(Post.count).to eq 2
31
+
32
+ Storey.switch("s2")
33
+ expect(Post.count).to eq 3
34
+
35
+ Storey.create "foobar"
36
+ Storey.switch "foobar"
37
+ Storey.switch { Post.create }
38
+ expect(Post.count).to be_zero
39
+ Storey.switch { expect(Post.count).to eq 1 }
28
40
  end
29
41
  end
30
42
 
data/spec/spec_helper.rb CHANGED
@@ -14,12 +14,6 @@ require 'pry'
14
14
  RSpec.configure do |config|
15
15
  config.order = 'random'
16
16
 
17
- config.before(:suite) do
18
- # Enable query cache so we can catch unexpected behaviour with AR
19
- # caching
20
- ActiveRecord::Base.connection.enable_query_cache!
21
- end
22
-
23
17
  config.before(:each) do
24
18
  # We don't want configuration to leak into other tests
25
19
  Storey.reload_config!
@@ -54,6 +48,10 @@ RSpec.configure do |config|
54
48
  ENV['STEP'] = ENV['VERSION'] = nil
55
49
  Rails.application.config.active_record.schema_format = :ruby
56
50
  Storey::Migrator.migrate_all
51
+
52
+ # Enable query cache so we can catch unexpected behaviour with AR
53
+ # caching
54
+ ActiveRecord::Base.connection.enable_query_cache!
57
55
  end
58
56
  end
59
57
 
@@ -82,8 +82,8 @@ describe Storey, "#switch" do
82
82
  it "should execute the block in the default schema" do
83
83
  Storey.switch "foobar"
84
84
  Storey.switch { Post.create }
85
- Post.count.should be_zero
86
- Storey.switch { Post.count.should == 1 }
85
+ expect(Post.count).to be_zero
86
+ Storey.switch { expect(Post.count).to eq 1 }
87
87
  end
88
88
 
89
89
  it "should return to the schema that the app was previously in" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storey
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails