Skip to content

Commit

Permalink
Remove route loading tests since it should be tested by railties
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Dec 14, 2009
1 parent ec99eca commit ce970a8
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -1623,78 +1623,6 @@ def sort_query_string_params(uri)
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)

Expand Down

0 comments on commit ce970a8

Please sign in to comment.