diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-03 17:36:08 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-03 21:24:01 -0800 |
commit | b160663bd13d08bf845bc8cdf87a2c5e7e46f901 (patch) | |
tree | 5144a55d7169b42132a878a65a583d9472b3b0b3 /actionpack/test | |
parent | 54302ef55bffd1a93f20f5d1ae81217b2e4149c4 (diff) | |
download | rails-b160663bd13d08bf845bc8cdf87a2c5e7e46f901.tar.gz rails-b160663bd13d08bf845bc8cdf87a2c5e7e46f901.tar.bz2 rails-b160663bd13d08bf845bc8cdf87a2c5e7e46f901.zip |
Start refactoring the method of configuring ActionView
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 15 | ||||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 14 | ||||
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 9 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 9 |
4 files changed, 23 insertions, 24 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index f1e8779cfa..7223a7824e 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -105,6 +105,21 @@ class RoutedRackApp end end +class BasicController + attr_accessor :request + + def config + @config ||= ActiveSupport::InheritableOptions.new(ActionController::Metal.config).tap do |config| + # VIEW TODO: View tests should not require a controller + public_dir = File.expand_path("../fixtures/public", __FILE__) + config.assets_dir = public_dir + config.javascripts_dir = "#{public_dir}/javascripts" + config.stylesheets_dir = "#{public_dir}/stylesheets" + config + end + end +end + class ActionController::IntegrationTest < ActiveSupport::TestCase def self.build_app(routes = nil) RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware| diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index ccc39e9af6..8b24f66a6e 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -12,13 +12,6 @@ end class AssetTagHelperTest < ActionView::TestCase tests ActionView::Helpers::AssetTagHelper - DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG.merge( - :assets_dir => File.dirname(__FILE__) + "/../fixtures/public", - :javascripts_dir => File.dirname(__FILE__) + "/../fixtures/public/javascripts", - :stylesheets_dir => File.dirname(__FILE__) + "/../fixtures/public/stylesheets") - - include ActiveSupport::Configurable - def setup super silence_warnings do @@ -41,7 +34,7 @@ class AssetTagHelperTest < ActionView::TestCase ) end - @controller = Class.new(FakeController) do + @controller = Class.new(BasicController) do def url_for(*args) "http://www.example.com" end end.new @@ -883,12 +876,9 @@ end class AssetTagHelperNonVhostTest < ActionView::TestCase tests ActionView::Helpers::AssetTagHelper - DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG - include ActiveSupport::Configurable - def setup super - @controller = Class.new(FakeController) do + @controller = Class.new(BasicController) do def url_for(options) "http://www.example.com/collaboration/hieraki" end diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 0ceec1afbf..c7d4bc986c 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -3,17 +3,16 @@ require 'abstract_unit' class FormTagHelperTest < ActionView::TestCase tests ActionView::Helpers::FormTagHelper - include ActiveSupport::Configurable - DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG + # include ActiveSupport::Configurable + # DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG def setup super - @controller = Class.new do + @controller = Class.new(BasicController) do def url_for(options) "http://www.example.com" end - end - @controller = @controller.new + end.new end VALID_HTML_ID = /^[A-Za-z][-_:.A-Za-z0-9]*$/ # see http://www.w3.org/TR/html4/types.html#type-name diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index d8ccb380a6..533a07b6f4 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -4,19 +4,14 @@ require 'active_support/ordered_options' require 'controller/fake_controllers' class UrlHelperTest < ActionView::TestCase - include ActiveSupport::Configurable - DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG def setup super - @controller = Class.new do - attr_accessor :url, :request + @controller = Class.new(BasicController) do + attr_accessor :url def url_for(options) url end - def config - ActiveSupport::InheritableOptions.new({}) - end end @controller = @controller.new |