Permalink
Browse files

Merge pull request #6036 from carlosantoniodasilva/routes-reloader-re…

…factor

Remove some warnings and minor refactor in RoutesReloader
  • Loading branch information...
2 parents 75df4c1 + 72a2edd commit 3de6a75d3fb06cc1da9251ed8ce1a11dd433d8cc @spastorino spastorino committed Apr 29, 2012
@@ -66,9 +66,10 @@ def inherited(base)
end
end
- attr_accessor :assets, :sandbox, :queue
+ attr_accessor :assets, :sandbox
alias_method :sandbox?, :sandbox
attr_reader :reloaders
+ attr_writer :queue
delegate :default_url_options, :default_url_options=, :to => :routes
@@ -24,12 +24,11 @@ def reload!
def updater
@updater ||= begin
- dirs = @external_routes.inject({}) do |hash, dir|
- hash.merge(dir.to_s => ["rb"])
+ dirs = @external_routes.each_with_object({}) do |dir, hash|
+ hash[dir.to_s] = %w(rb)
end
updater = ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! }
-
updater.execute
updater
end
@@ -249,9 +249,7 @@ def baz
assert_equal 404, last_response.status
end
end
- end
- {"development" => "baz", "production" => "bar"}.each do |mode, expected|
test "reloads routes when configuration is changed in #{mode}" do
controller :foo, <<-RUBY
class FooController < ApplicationController
@@ -18,7 +18,6 @@
# These files do not require any others and are needed
# to run the tests
require "#{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/testing/isolation"
-require "#{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/testing/declarative"
require "#{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/core_ext/kernel/reporting"
module TestHelpers
@@ -268,7 +267,6 @@ class ActiveSupport::TestCase
include TestHelpers::Paths
include TestHelpers::Rack
include TestHelpers::Generation
- extend ActiveSupport::Testing::Declarative
end
# Create a scope and build a fixture rails app

0 comments on commit 3de6a75

Please sign in to comment.