diff --git a/lib/thor/base.rb b/lib/thor/base.rb index 442732876..cc7505143 100644 --- a/lib/thor/base.rb +++ b/lib/thor/base.rb @@ -9,7 +9,7 @@ class Thor HELP_MAPPINGS = %w(-h -? --help -D) - THOR_RESERVED_WORDS = %w(all invoke shell options behavior root destination_root relative_root source_root) + THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root source_root) class Maxima < Struct.new(:usage, :options, :class_options) end @@ -391,7 +391,7 @@ def class_options_help(shell, ungrouped_name=nil) #:nodoc: # def is_thor_reserved_word?(word, type) return false unless THOR_RESERVED_WORDS.include?(word.to_s) - raise ScriptError, "'#{word}' is a Thor reserved word and cannot be defined as #{type}" + raise "'#{word}' is a Thor reserved word and cannot be defined as #{type}" end # Build an option and adds it to the given scope. diff --git a/spec/base_spec.rb b/spec/base_spec.rb index 518c814d0..6a4067dc3 100644 --- a/spec/base_spec.rb +++ b/spec/base_spec.rb @@ -169,8 +169,9 @@ def hello it "raises an error if a task with reserved word is defined" do lambda { - MyCounter.class_eval "def all; end" - }.must raise_error(ScriptError, /'all' is a Thor reserved word and cannot be defined as task/) + klass = Class.new(Thor::Group) + klass.class_eval "def shell; end" + }.must raise_error(RuntimeError, /'shell' is a Thor reserved word and cannot be defined as task/) end end