duoconsole 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/duoconsole.rb +13 -5
  2. metadata +2 -2
data/lib/duoconsole.rb CHANGED
@@ -33,11 +33,7 @@ class Duoconsole
33
33
 
34
34
  def fork_child
35
35
  child_pid = fork do
36
- ENV['RAILS_ENV'] = 'test'
37
-
38
- if defined?(Rails)
39
- Rails.env = 'test'
40
- end
36
+ Rails.env = ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
41
37
 
42
38
  load_application
43
39
  monkeypatch_test_environment
@@ -59,6 +55,18 @@ class Duoconsole
59
55
 
60
56
  def load_application
61
57
  require APP_PATH
58
+
59
+ if Rails.env.test?
60
+ # Initializer copied from https://github.com/jonleighton/spring/blob/master/lib/spring/application.rb#L30
61
+ #
62
+ # The test environment has config.cache_classes = true set by default.
63
+ # However, we don't want this to prevent us from performing class reloading,
64
+ # so this gets around that.
65
+ Rails::Application.initializer :initialize_dependency_mechanism, group: :all do
66
+ ActiveSupport::Dependencies.mechanism = :load
67
+ end
68
+ end
69
+
62
70
  Rails.application.require_environment!
63
71
  end
64
72
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duoconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-29 00:00:00.000000000 Z
12
+ date: 2012-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails