diff --git a/test/controller_mixin_helpers_test.rb b/test/controller_mixin_helpers_test.rb index 81abeb4..e01732f 100644 --- a/test/controller_mixin_helpers_test.rb +++ b/test/controller_mixin_helpers_test.rb @@ -13,6 +13,7 @@ def checkpoint def tab_for(tab, name, *args) end + end class NilBoundariesBuilder < TabsOnRails::Tabs::Builder @@ -35,10 +36,10 @@ def open_tabs class ControllerMixinHelpersTest < ActionView::TestCase + tests TabsOnRails::ControllerMixin::HelperMethods include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper - include TabsOnRails::ControllerMixin::HelperMethods - + def test_tabs_tag_should_raise_local_jump_error_without_block assert_raise(LocalJumpError) { tabs_tag } diff --git a/test/controller_mixin_test.rb b/test/controller_mixin_test.rb index b40e12c..3cddc4a 100644 --- a/test/controller_mixin_test.rb +++ b/test/controller_mixin_test.rb @@ -1,11 +1,9 @@ require 'test_helper' -class MixinController < ActionController::Base -end +class ControllerMixinTest < ActiveSupport::TestCase + class MixinController < ActionController::Base; end -class ControllerMixinTest < ActiveSupport::TestCase - def setup @controller = MixinController.new @request = ActionController::TestRequest.new @@ -95,4 +93,4 @@ def test_deprecated_current_tab_setter end end -end +end \ No newline at end of file diff --git a/test/controller_test.rb b/test/controller_mixin_with_controller_test.rb similarity index 64% rename from test/controller_test.rb rename to test/controller_mixin_with_controller_test.rb index 4f6db2c..00ab554 100644 --- a/test/controller_test.rb +++ b/test/controller_mixin_with_controller_test.rb @@ -1,40 +1,38 @@ require 'test_helper' -class MixinController < ActionController::Base - def self.controller_name; "mixin"; end - def self.controller_path; "mixin"; end +class ControllerMixinWithControllerTest < ActiveSupport::TestCase - layout false - - set_tab :dashboard - set_tab :welcome, :only => %w(action_welcome) - set_tab :dashboard, :only => %w(action_namespace) - set_tab :homepage, :namespace, :only => %w(action_namespace) + class MixinController < ActionController::Base + def self.controller_name; "mixin"; end + def self.controller_path; "mixin"; end - # Deprecated. - current_tab :deprecated, :only => %w(action_current_tab) - + layout false - def method_missing(method, *args) - if method =~ /^action_(.*)/ - render :action => (params[:template] || 'standard') - end - end + set_tab :dashboard + set_tab :welcome, :only => %w(action_welcome) + set_tab :dashboard, :only => %w(action_namespace) + set_tab :homepage, :namespace, :only => %w(action_namespace) + # Deprecated. + current_tab :deprecated, :only => %w(action_current_tab) - def rescue_action(e) raise end -end + def method_missing(method, *args) + if method =~ /^action_(.*)/ + render :action => (params[:template] || 'standard') + end + end -MixinController.view_paths = [ File.dirname(__FILE__) + "/fixtures/" ] + def rescue_action(e) raise end + end + MixinController.view_paths = [ File.dirname(__FILE__) + "/fixtures/" ] -class ControllerMixinTest < ActiveSupport::TestCase - def setup @controller = MixinController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end - + + def test_set_tab get :action_dashboard assert_equal(:dashboard, @controller.current_tab) @@ -44,7 +42,7 @@ def test_set_tab