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)
150
150
151
151
client_args , client_env = JSON . load ( client . read ( client . gets . to_i ) ) . values_at ( "args" , "env" )
152
152
153
- set_env_vars ( client_env )
154
-
155
153
preload unless preloaded?
156
154
command = Spring . command ( client_args . shift )
157
155
@@ -169,6 +167,7 @@ def serve(client)
169
167
170
168
ARGV . replace ( client_args )
171
169
$0 = command . process_title
170
+ set_env_vars ( client_env )
172
171
173
172
# requiring is faster, so if config.cache_classes was true in
174
173
# 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
292
292
end
293
293
294
294
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"
298
301
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"
302
304
end
303
305
304
306
test "setting env vars with rake" do
Original file line number Diff line number Diff line change @@ -121,10 +121,6 @@ def application_config
121
121
path "config/application.rb"
122
122
end
123
123
124
- def some_initializer
125
- path "config/initializers/foo.rb"
126
- end
127
-
128
124
def spring_config
129
125
path "config/spring.rb"
130
126
end
@@ -299,7 +295,6 @@ def generate
299
295
FileUtils . rm_rf ( application . path ( "test/performance" ) )
300
296
301
297
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 " )
303
298
304
299
if version . needs_testunit?
305
300
File . write ( application . gemfile , "#{ application . gemfile . read } gem 'spring-commands-testunit'\n " )
You can’t perform that action at this time.
0 commit comments