File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,6 @@ def serve(client)
150150
151151 client_args , client_env = JSON . load ( client . read ( client . gets . to_i ) ) . values_at ( "args" , "env" )
152152
153- set_env_vars ( client_env )
154-
155153 preload unless preloaded?
156154 command = Spring . command ( client_args . shift )
157155
@@ -169,6 +167,7 @@ def serve(client)
169167
170168 ARGV . replace ( client_args )
171169 $0 = command . process_title
170+ set_env_vars ( client_env )
172171
173172 # requiring is faster, so if config.cache_classes was true in
174173 # the environment's config file, then we can respect that from
Original file line number Diff line number Diff line change @@ -292,13 +292,15 @@ def binstub_prelude
292292 end
293293
294294 test "config via environment variable" do
295- app . env [ 'FORCE_SSL' ] = '1'
296- app . env [ 'RAILS_ENV' ] = 'test'
297- assert_success "bin/rails runner 'p Rails.application.config.force_ssl'" , stdout : "true"
295+ File . write ( application . path ( 'config/initializers/set_foo.rb' , <<-CONFIG )
296+ Rails.application.config.foo = !!ENV['FOO']
297+ CONFIG
298+
299+ app . env [ 'FOO' ] = '1'
300+ assert_success "bin/rails runner -e test 'p Rails.application.config.foo'" , stdout : "true"
298301
299- app . env [ 'FORCE_SSL' ] = '0'
300- app . env [ 'RAILS_ENV' ] = 'development'
301- assert_success "bin/rails runner 'p Rails.application.config.force_ssl'" , stdout : "false"
302+ app . env [ 'FOO' ] = nil
303+ assert_success "bin/rails runner -e development 'p Rails.application.config.foo'" , stdout : "false"
302304 end
303305
304306 test "setting env vars with rake" do
Original file line number Diff line number Diff line change @@ -121,10 +121,6 @@ def application_config
121121 path "config/application.rb"
122122 end
123123
124- def some_initializer
125- path "config/initializers/foo.rb"
126- end
127-
128124 def spring_config
129125 path "config/spring.rb"
130126 end
@@ -299,7 +295,6 @@ def generate
299295 FileUtils . rm_rf ( application . path ( "test/performance" ) )
300296
301297 File . write ( application . gemfile , "#{ application . gemfile . read } gem 'spring', '#{ Spring ::VERSION } '\n " )
302- File . write ( application . some_initializer , "Rails.application.config.force_ssl = ('1' == ENV['FORCE_SSL'])\n " )
303298
304299 if version . needs_testunit?
305300 File . write ( application . gemfile , "#{ application . gemfile . read } gem 'spring-commands-testunit'\n " )
You can’t perform that action at this time.
0 commit comments