@@ -242,63 +242,6 @@ def log_initializer
242
242
booter . to_app . should == app
243
243
end
244
244
245
- it "should set config.action_controller.relative_url_root based on ENV['RAILS_RELATIVE_URL_ROOT']" do
246
- ENV [ 'RAILS_RELATIVE_URL_ROOT' ] = '/blah'
247
- app = double "app"
248
- app . stub_chain ( :config , :action_controller , :relative_url_root )
249
- app . config . action_controller . should_receive ( :relative_url_root= ) . with ( "/blah" )
250
- before_config = Rails ::Railtie . __initializer . detect { |i | i . first =~ /url/ }
251
- before_config . should_not be_nil
252
- before_config [ 1 ] . should == [ { :after => "action_controller.set_configs" } ]
253
- before_config . last . call ( app )
254
- end
255
-
256
- end # if defined? Rails
257
-
258
- # NOTE: specs currently only test with a stubbed Rails::Railtie
259
- describe "Rails 3.1" , :lib => [ :stub ] do
260
-
261
- before :each do
262
- $servlet_context = @servlet_context
263
- #booter.layout_class = JRuby::Rack::FileSystemLayout
264
- booter . app_path = RAILS_ROOT_DIR . dup
265
- def booter . rails2? ; false end
266
- booter . boot!
267
- booter . load_environment
268
- end
269
-
270
- after :all do
271
- $servlet_context = nil
272
- end
273
-
274
- #
275
- # relative_url_root= has been deprecated in Rails > 3. We should not call it when it's not defined.
276
- # See: https://github.com/jruby/jruby-rack/issues/73
277
- # https://github.com/rails/rails/issues/2435
278
- #
279
- it "should not set config.action_controller.relative_url_root if the controller doesn't respond to that method" do
280
- require 'action_controller' # stub
281
- begin
282
- #ActionController::Base.send :remove_method, :relative_url_root=
283
- ENV [ 'RAILS_RELATIVE_URL_ROOT' ] = '/blah'
284
- app = double "app"
285
- app . stub_chain ( :config , :action_controller )
286
- app . config . stub ( :action_controller ) . and_return ( nil )
287
- # app.config.action_controller.should_not_receive(:relative_url_root=)
288
- ActionController ::Base . stub ( :config ) . and_return app . config
289
-
290
- app . config . should_receive ( :relative_url_root= ) . with ( '/blah' )
291
- ActionController ::Base . should_not_receive ( :relative_url_root= )
292
-
293
- init = Rails ::Railtie . __initializer . detect { |i | i . first =~ /url/ }
294
- init . should_not be nil
295
- init [ 1 ] . should == [ { :after => "action_controller.set_configs" } ]
296
- init . last . call ( app )
297
- ensure
298
- #ActionController::Base.send :attr_writer, :relative_url_root
299
- end
300
- end
301
-
302
245
end # if defined? Rails
303
246
304
247
end
0 commit comments