diff --git a/vendor/plugins/design/init.rb b/vendor/plugins/design/init.rb index a51b0c0..d8a924f 100644 --- a/vendor/plugins/design/init.rb +++ b/vendor/plugins/design/init.rb @@ -5,6 +5,9 @@ class ActionController::Base # Declares that this controller uses design plugin to generate its layout. # See the plugin README for options that can be passed to this method. def self.design(config = {}) + + raise ArgumentError.new("design argument must be a Hash") unless config.kind_of? Hash + if (config.has_key?(:holder) && config.has_key?(:fixed)) || (!config.has_key?(:holder) && !config.has_key?(:fixed)) raise ArgumentError.new("You must supply either :holder or :fixed to design.") end diff --git a/vendor/plugins/design/test/design_test.rb b/vendor/plugins/design/test/design_test.rb index 7b9cf05..12850d5 100644 --- a/vendor/plugins/design/test/design_test.rb +++ b/vendor/plugins/design/test/design_test.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), 'test_helper') -class FixedDesignHolderTest < Test::Unit::TestCase +class DesignTest < Test::Unit::TestCase def test_design_should_include_design_module assert FixedDesignTestController.included_modules.include?(Design) @@ -21,4 +21,10 @@ class FixedDesignHolderTest < Test::Unit::TestCase DesignEditorTestController.design :holder => 'something', :fixed => true end end + def test_should_not_accept_non_hash + assert_raise ArgumentError do + DesignEditorTestController.design :fixed + end + end + end diff --git a/vendor/plugins/design/test/test_helper.rb b/vendor/plugins/design/test/test_helper.rb index 026ecf5..bf98f51 100644 --- a/vendor/plugins/design/test/test_helper.rb +++ b/vendor/plugins/design/test/test_helper.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environme require 'test/unit' +# from Rails +require 'test_help' + # load the database schema for the tests ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") load(File.dirname(__FILE__) + '/schema.rb') -- libgit2 0.21.2