Remove route loading tests since it should be tested by railties

This commit is contained in:
Joshua Peek
2009-12-14 16:52:22 -06:00
parent ec99eca013
commit ce970a8bb9

View File

@@ -1623,78 +1623,6 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
class RouteLoadingTest < Test::Unit::TestCase
def setup
routes.instance_variable_set '@routes_last_modified', nil
Object.remove_const(:RAILS_ROOT) if defined?(::RAILS_ROOT)
Object.const_set :RAILS_ROOT, '.'
routes.add_configuration_file(File.join(RAILS_ROOT, 'config', 'routes.rb'))
@stat = stub_everything
end
def teardown
ActionController::Routing::Routes.configuration_files.clear
Object.send :remove_const, :RAILS_ROOT
end
def test_load
File.expects(:stat).returns(@stat)
routes.expects(:load).with(regexp_matches(/routes\.rb$/))
routes.reload
end
def test_no_reload_when_not_modified
@stat.expects(:mtime).times(2).returns(1)
File.expects(:stat).times(2).returns(@stat)
routes.expects(:load).with(regexp_matches(/routes\.rb$/)).at_most_once
2.times { routes.reload }
end
def test_reload_when_modified
@stat.expects(:mtime).at_least(2).returns(1, 2)
File.expects(:stat).at_least(2).returns(@stat)
routes.expects(:load).with(regexp_matches(/routes\.rb$/)).times(2)
2.times { routes.reload }
end
def test_bang_forces_reload
@stat.expects(:mtime).at_least(2).returns(1)
File.expects(:stat).at_least(2).returns(@stat)
routes.expects(:load).with(regexp_matches(/routes\.rb$/)).times(2)
2.times { routes.reload! }
end
def test_load_with_configuration
routes.configuration_files.clear
routes.add_configuration_file("foobarbaz")
File.expects(:stat).returns(@stat)
routes.expects(:load).with("foobarbaz")
routes.reload
end
def test_load_multiple_configurations
routes.add_configuration_file("engines.rb")
File.expects(:stat).at_least_once.returns(@stat)
routes.expects(:load).with('./config/routes.rb')
routes.expects(:load).with('engines.rb')
routes.reload
end
private
def routes
ActionController::Routing::Routes
end
end
class RackMountIntegrationTests < ActiveSupport::TestCase
Model = Struct.new(:to_param)