con_air 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTI2MGY0ZGMzZmU1ZGQ5YjU3NjIxOWI4MWIzMDdlYmFjYzZhNWU5MQ==
4
+ YjFmYzRkMmFlZTZlNmE3ODVmNWMyYjRiN2Y3ZDMwZTI1ZGU4MmI5ZQ==
5
5
  data.tar.gz: !binary |-
6
- YTY2OTJjYTY5ZDRmM2VkYzVlNDc2M2ZiZjAzODc4YjkwOWE4NDNlNQ==
6
+ YTFkM2Y4OGI4ZmMzMmU1OWUyMjVjNDI0YzYxMjA3Zjk0MzFjZGE3Mw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmRiNDYyNTFiMTY2YTI4MjYxYTY1NmQ4ZDA3NGNiNmYyODMyNzdiZmRjMGUz
10
- YmE1YWUyOTA3MWIzNzFmNTg4ZTQxMWJlMThjNDQ5NjU0MmM5ZTRjYjYyYTli
11
- YWQzODIyOTMxY2YwZTY2ZmQ5NjBhNzEyYzUyMWFkZGRlOTY0NDM=
9
+ ZGIxZDY3YWZjNjkyOTQzZWE2YjhiZWFhZGIzYWNjY2VmOTAxZjJiNmVkODdl
10
+ MWRjNzcxNWM3OTkwYzgwNjA2ZjhkZGI4MDEzNmU5NDcyMDA0ZjMyNzg4MTMx
11
+ NmU0YzcxNTRiMjgzYzU2NDc2MDYyM2Y0NjU0NjRmZDZlZmQwNWU=
12
12
  data.tar.gz: !binary |-
13
- NzdmNTRhMDM0M2FjOGIzNjUyNWExZWUxMTlmMDc4YjAyYmI2NGQ3ODZhMTg4
14
- M2U4YTc1OTc2N2MwZjNhMjdjMzQzYmI5MWYzYWVkNjYwYTQ2YTFkODQ3Mjg1
15
- YmJmODBiMGUwMDcwMjMxZjQwMWM2NTg5YjkzZDU0NGY4ZjJiOTQ=
13
+ MjMwMTZlYTMzZDFkYmRjNGI3NjFmMjRiYTBmODA2ZTQyNDRkMzJmNjViZTIx
14
+ MjVjMGNkOTE5MjU0ZDIyMmNhMTgxZDE2Nzk4NTU3NWJjYWZhMmMzMDlmMzgz
15
+ ODE1MTZlNmMyMzFjMjkyNGQ0ZDk1ZTRhNDkxN2I5ZTA3ODY5NzY=
@@ -9,6 +9,9 @@ module ConAir
9
9
 
10
10
  @hijacked_spec = hijacked_spec
11
11
  @swap_class = swap_class
12
+
13
+ # Init all connections after switching handler
14
+ ActiveRecord::Base.establish_connection
12
15
  end
13
16
 
14
17
  def establish_connection(name, spec)
@@ -1,3 +1,3 @@
1
1
  module ConAir
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/con_air.rb CHANGED
@@ -14,7 +14,8 @@ module ConAir
14
14
  ar.handler_hijackings[ar.connection_id] = ConnectionHandler.new(klass, spec)
15
15
  end
16
16
 
17
- ar.establish_connection
17
+ # Init the hijaking connection for class
18
+ klass.establish_connection
18
19
 
19
20
  yield
20
21
  ensure
data/spec/con_air_spec.rb CHANGED
@@ -16,7 +16,7 @@ describe ConAir do
16
16
  @new_handler = DummyHandler.new
17
17
  @config = double
18
18
 
19
- allow(ActiveRecord::Base).to receive(:establish_connection)
19
+ allow(klass).to receive(:establish_connection)
20
20
  allow(@new_handler).to receive(:hijacked_spec).and_return(double(config: @config))
21
21
  allow(ConAir::ConnectionHandler).to receive(:new).with(klass, @spec).and_return(@new_handler)
22
22
  allow(ActiveRecord::Base::ConnectionSpecification).to receive(:new).and_return(@spec)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: con_air
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-20 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails