mirror of
				https://github.com/pry/pry.git
				synced 2022-11-09 12:35:05 -05:00 
			
		
		
		
	rename Pry::CommandSet#commands as Pry::CommandSet#to_hash.
'Pry.commands.commands' gone in favor of 'Pry.commands.to_hash' or as using a CommandSet as an enumerable (Pry.commands.each etc) instead.
This commit is contained in:
		
							parent
							
								
									c283e644b5
								
							
						
					
					
						commit
						77a9c00067
					
				
					 7 changed files with 81 additions and 73 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,7 @@
 | 
			
		|||
### 1.0.0 (2013/??/??)
 | 
			
		||||
#### Dependency changes
 | 
			
		||||
 | 
			
		||||
* 1.8 support discontinued from 1.0+ onwards.
 | 
			
		||||
  * 0.9.12+ may continue to provide 1.8+ bug fixes.
 | 
			
		||||
 | 
			
		||||
* 1.8 support discontinued from 0.10/1.0 up.  0.9 branch continues 1.8 support.
 | 
			
		||||
* Require Coderay `>= 1.1.0`
 | 
			
		||||
 | 
			
		||||
#### Features
 | 
			
		||||
| 
						 | 
				
			
			@ -25,6 +23,11 @@
 | 
			
		|||
* require of 'readline' is delayed until Pry.start() has been called for the first time. (#1117)
 | 
			
		||||
* add option to disable input completer through `_pry_.config.completer = nil`
 | 
			
		||||
 | 
			
		||||
#### API change.
 | 
			
		||||
* CommandSet#commands, sometimes referenced through Pry.commands.commands, renamed as 'CommandSet#to_hash'.
 | 
			
		||||
  it returns a duplicate of the internal hash a CommandSet uses.
 | 
			
		||||
* CommandSet#keys is now an alias of CommandSet#list_commands.
 | 
			
		||||
 | 
			
		||||
#### Bug fixes, etc.
 | 
			
		||||
* `binding.pry` inside `.pryrc` file now works, with some limitations (@richo / #1118)
 | 
			
		||||
* Add support for BasicObjects to `ls` (#984)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -248,7 +248,7 @@ class Pry
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def commands
 | 
			
		||||
      command_set.commands
 | 
			
		||||
      command_set.to_hash
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,19 +10,15 @@ class Pry
 | 
			
		|||
  class CommandSet
 | 
			
		||||
    include Enumerable
 | 
			
		||||
    include Pry::Helpers::BaseHelpers
 | 
			
		||||
 | 
			
		||||
    attr_reader :commands
 | 
			
		||||
    attr_reader :helper_module
 | 
			
		||||
 | 
			
		||||
    # @param [Array<CommandSet>] imported_sets Sets which will be imported
 | 
			
		||||
    #   automatically
 | 
			
		||||
    # @param [Array<Commandset>] imported_sets
 | 
			
		||||
    #   Sets which will be imported automatically
 | 
			
		||||
    # @yield Optional block run to define commands
 | 
			
		||||
    def initialize(*imported_sets, &block)
 | 
			
		||||
      @commands      = {}
 | 
			
		||||
      @helper_module = Module.new
 | 
			
		||||
 | 
			
		||||
      import(*imported_sets)
 | 
			
		||||
 | 
			
		||||
      instance_eval(&block) if block
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +79,7 @@ class Pry
 | 
			
		|||
      description, options = ["No description.", description] if description.is_a?(Hash)
 | 
			
		||||
      options = Pry::Command.default_options(match).merge!(options)
 | 
			
		||||
 | 
			
		||||
      commands[match] = Pry::BlockCommand.subclass(match, description, options, helper_module, &block)
 | 
			
		||||
      @commands[match] = Pry::BlockCommand.subclass(match, description, options, helper_module, &block)
 | 
			
		||||
    end
 | 
			
		||||
    alias_method :command, :block_command
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -115,9 +111,9 @@ class Pry
 | 
			
		|||
      description, options = ["No description.", description] if description.is_a?(Hash)
 | 
			
		||||
      options = Pry::Command.default_options(match).merge!(options)
 | 
			
		||||
 | 
			
		||||
      commands[match] = Pry::ClassCommand.subclass(match, description, options, helper_module, &block)
 | 
			
		||||
      commands[match].class_eval(&block)
 | 
			
		||||
      commands[match]
 | 
			
		||||
      @commands[match] = Pry::ClassCommand.subclass(match, description, options, helper_module, &block)
 | 
			
		||||
      @commands[match].class_eval(&block)
 | 
			
		||||
      @commands[match]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Execute a block of code before a command is invoked. The block also
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +153,7 @@ class Pry
 | 
			
		|||
    def delete(*searches)
 | 
			
		||||
      searches.each do |search|
 | 
			
		||||
        cmd = find_command_by_match_or_listing(search)
 | 
			
		||||
        commands.delete cmd.match
 | 
			
		||||
        @commands.delete cmd.match
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +163,7 @@ class Pry
 | 
			
		|||
    # @return [Pry::CommandSet] Returns the reciever (a command set).
 | 
			
		||||
    def import(*sets)
 | 
			
		||||
      sets.each do |set|
 | 
			
		||||
        commands.merge! set.commands
 | 
			
		||||
        @commands.merge! set.to_hash
 | 
			
		||||
        helper_module.send :include, set.helper_module
 | 
			
		||||
      end
 | 
			
		||||
      self
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +177,7 @@ class Pry
 | 
			
		|||
      helper_module.send :include, set.helper_module
 | 
			
		||||
      matches.each do |match|
 | 
			
		||||
        cmd = set.find_command_by_match_or_listing(match)
 | 
			
		||||
        commands[cmd.match] = cmd
 | 
			
		||||
        @commands[cmd.match] = cmd
 | 
			
		||||
      end
 | 
			
		||||
      self
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -190,8 +186,8 @@ class Pry
 | 
			
		|||
    #   of the command to retrieve.
 | 
			
		||||
    # @return [Command] The command object matched.
 | 
			
		||||
    def find_command_by_match_or_listing(match_or_listing)
 | 
			
		||||
      cmd = (commands[match_or_listing] ||
 | 
			
		||||
        Pry::Helpers::BaseHelpers.find_command(match_or_listing, commands))
 | 
			
		||||
      cmd = (@commands[match_or_listing] ||
 | 
			
		||||
        Pry::Helpers::BaseHelpers.find_command(match_or_listing, @commands))
 | 
			
		||||
      cmd or raise ArgumentError, "Cannot find a command: '#{match_or_listing}'!"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -250,11 +246,11 @@ class Pry
 | 
			
		|||
        :description => cmd.description
 | 
			
		||||
      }.merge!(options)
 | 
			
		||||
 | 
			
		||||
      commands[new_match] = cmd.dup
 | 
			
		||||
      commands[new_match].match = new_match
 | 
			
		||||
      commands[new_match].description = options.delete(:description)
 | 
			
		||||
      commands[new_match].options.merge!(options)
 | 
			
		||||
      commands.delete(cmd.match)
 | 
			
		||||
      @commands[new_match] = cmd.dup
 | 
			
		||||
      @commands[new_match].match = new_match
 | 
			
		||||
      @commands[new_match].description = options.delete(:description)
 | 
			
		||||
      @commands[new_match].options.merge!(options)
 | 
			
		||||
      @commands.delete(cmd.match)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def disabled_command(name_of_disabled_command, message, matcher=name_of_disabled_command)
 | 
			
		||||
| 
						 | 
				
			
			@ -303,16 +299,23 @@ class Pry
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # @return [Array] The list of commands provided by the command set.
 | 
			
		||||
    # @return [Array]
 | 
			
		||||
    #   The list of commands provided by the command set.
 | 
			
		||||
    def list_commands
 | 
			
		||||
      commands.keys
 | 
			
		||||
      @commands.keys
 | 
			
		||||
    end
 | 
			
		||||
    alias_method :keys, :list_commands
 | 
			
		||||
 | 
			
		||||
    def to_hash
 | 
			
		||||
      @commands.dup
 | 
			
		||||
    end
 | 
			
		||||
    alias_method :to_h, :to_hash
 | 
			
		||||
 | 
			
		||||
    # Find a command that matches the given line
 | 
			
		||||
    # @param [String] val The line that might be a command invocation
 | 
			
		||||
    # @return [Pry::Command, nil]
 | 
			
		||||
    def [](pattern)
 | 
			
		||||
      commands.values.select do |command|
 | 
			
		||||
      @commands.values.select do |command|
 | 
			
		||||
        command.matches?(pattern)
 | 
			
		||||
      end.sort_by do |command|
 | 
			
		||||
        command.match_score(pattern)
 | 
			
		||||
| 
						 | 
				
			
			@ -337,7 +340,7 @@ class Pry
 | 
			
		|||
    #
 | 
			
		||||
    def []=(pattern, command)
 | 
			
		||||
      if command.equal?(nil)
 | 
			
		||||
        return commands.delete(pattern)
 | 
			
		||||
        return @commands.delete(pattern)
 | 
			
		||||
      end
 | 
			
		||||
      unless Class === command && command < Pry::Command
 | 
			
		||||
        raise TypeError, "command is not a subclass of Pry::Command"
 | 
			
		||||
| 
						 | 
				
			
			@ -396,7 +399,7 @@ class Pry
 | 
			
		|||
 | 
			
		||||
    # @private (used for testing)
 | 
			
		||||
    def run_command(context, match, *args)
 | 
			
		||||
      command = commands[match] or raise NoCommandError.new(match, self)
 | 
			
		||||
      command = @commands[match] or raise NoCommandError.new(match, self)
 | 
			
		||||
      command.new(context).call_safely(*args)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -408,7 +411,7 @@ class Pry
 | 
			
		|||
      if command = find_command(search)
 | 
			
		||||
        command.new(context).complete(search)
 | 
			
		||||
      else
 | 
			
		||||
        commands.keys.select do |key|
 | 
			
		||||
        @commands.keys.select do |key|
 | 
			
		||||
          String === key && key.start_with?(search)
 | 
			
		||||
        end.map{ |key| key + " " } + Bond::DefaultMission.completions
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ class Pry::Config::Default
 | 
			
		|||
    :control_d_handler      => proc { Pry::DEFAULT_CONTROL_D_HANDLER },
 | 
			
		||||
    :memory_size            => proc { 100 },
 | 
			
		||||
    :extra_sticky_locals    => proc { {} },
 | 
			
		||||
    :command_completions    => proc { proc { commands.commands.keys } },
 | 
			
		||||
    :command_completions    => proc { proc { commands.keys } },
 | 
			
		||||
    :file_completions       => proc { proc { Dir["."] } },
 | 
			
		||||
    :completer              => proc { lazy_completer }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -473,22 +473,23 @@ describe "commands" do
 | 
			
		|||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    klass.commands.include?("nesting").should == true
 | 
			
		||||
    klass.commands.include?("jump-to").should == true
 | 
			
		||||
    klass.commands.include?("cd").should == true
 | 
			
		||||
    klass.commands.include?("v").should == true
 | 
			
		||||
    klass.to_hash.include?("nesting").should == true
 | 
			
		||||
    klass.to_hash.include?("jump-to").should == true
 | 
			
		||||
    klass.to_hash.include?("cd").should == true
 | 
			
		||||
    klass.to_hash.include?("v").should == true
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should change description of a command using desc' do
 | 
			
		||||
    klass = Pry::CommandSet.new do
 | 
			
		||||
      import Pry::Commands
 | 
			
		||||
    end
 | 
			
		||||
    orig = klass.commands["help"].description
 | 
			
		||||
    orig = klass["help"].description
 | 
			
		||||
    klass.instance_eval do
 | 
			
		||||
      desc "help", "blah"
 | 
			
		||||
    end
 | 
			
		||||
    klass.commands["help"].description.should.not == orig
 | 
			
		||||
    klass.commands["help"].description.should == "blah"
 | 
			
		||||
    commands = klass.to_hash
 | 
			
		||||
    commands["help"].description.should.not == orig
 | 
			
		||||
    commands["help"].description.should == "blah"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should enable an inherited method to access opts and output and target, due to instance_exec' do
 | 
			
		||||
| 
						 | 
				
			
			@ -512,8 +513,8 @@ describe "commands" do
 | 
			
		|||
      import_from Pry::Commands, "ls", "jump-to"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    klass.commands.include?("ls").should == true
 | 
			
		||||
    klass.commands.include?("jump-to").should == true
 | 
			
		||||
    klass.to_hash.include?("ls").should == true
 | 
			
		||||
    klass.to_hash.include?("jump-to").should == true
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should delete some inherited commands when using delete method' do
 | 
			
		||||
| 
						 | 
				
			
			@ -525,13 +526,14 @@ describe "commands" do
 | 
			
		|||
      delete "ls"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    klass.commands.include?("nesting").should == true
 | 
			
		||||
    klass.commands.include?("jump-to").should == true
 | 
			
		||||
    klass.commands.include?("cd").should == true
 | 
			
		||||
    klass.commands.include?("v").should == true
 | 
			
		||||
    klass.commands.include?("show-doc").should == false
 | 
			
		||||
    klass.commands.include?("show-method").should == false
 | 
			
		||||
    klass.commands.include?("ls").should == false
 | 
			
		||||
    commands = klass.to_hash
 | 
			
		||||
    commands.include?("nesting").should == true
 | 
			
		||||
    commands.include?("jump-to").should == true
 | 
			
		||||
    commands.include?("cd").should == true
 | 
			
		||||
    commands.include?("v").should == true
 | 
			
		||||
    commands.include?("show-doc").should == false
 | 
			
		||||
    commands.include?("show-method").should == false
 | 
			
		||||
    commands.include?("ls").should == false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should override some inherited commands' do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ describe Pry::CommandSet do
 | 
			
		|||
 | 
			
		||||
  it 'should set the descriptions of commands' do
 | 
			
		||||
    @set.command('foo', 'some stuff') {}
 | 
			
		||||
    @set.commands['foo'].description.should == 'some stuff'
 | 
			
		||||
    @set['foo'].description.should == 'some stuff'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "aliases" do
 | 
			
		||||
| 
						 | 
				
			
			@ -176,8 +176,8 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command('foo', 'stuff') { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command 'bar', 'foo'
 | 
			
		||||
      @set.commands['bar'].match.should == 'bar'
 | 
			
		||||
      @set.commands['bar'].description.should == 'Alias for `foo`'
 | 
			
		||||
      @set['bar'].match.should == 'bar'
 | 
			
		||||
      @set['bar'].description.should == 'Alias for `foo`'
 | 
			
		||||
 | 
			
		||||
      @set.run_command @ctx, 'bar'
 | 
			
		||||
      run.should == true
 | 
			
		||||
| 
						 | 
				
			
			@ -188,12 +188,12 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command('foo', 'stuff', :shellwords => true, :interpolate => false) { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command 'bar', 'foo'
 | 
			
		||||
      @set.commands['bar'].options[:shellwords].should == @set.commands['foo'].options[:shellwords]
 | 
			
		||||
      @set.commands['bar'].options[:interpolate].should == @set.commands['foo'].options[:interpolate]
 | 
			
		||||
      @set['bar'].options[:shellwords].should == @set['foo'].options[:shellwords]
 | 
			
		||||
      @set['bar'].options[:interpolate].should == @set['foo'].options[:interpolate]
 | 
			
		||||
 | 
			
		||||
      # however some options should not be inherited
 | 
			
		||||
      @set.commands['bar'].options[:listing].should.not ==  @set.commands['foo'].options[:listing]
 | 
			
		||||
      @set.commands['bar'].options[:listing].should == "bar"
 | 
			
		||||
      @set['bar'].options[:listing].should.not ==  @set['foo'].options[:listing]
 | 
			
		||||
      @set['bar'].options[:listing].should == "bar"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should be able to specify alias\'s description when aliasing' do
 | 
			
		||||
| 
						 | 
				
			
			@ -201,8 +201,8 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command('foo', 'stuff') { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command 'bar', 'foo', :desc => "tobina"
 | 
			
		||||
      @set.commands['bar'].match.should == 'bar'
 | 
			
		||||
      @set.commands['bar'].description.should == "tobina"
 | 
			
		||||
      @set['bar'].match.should == 'bar'
 | 
			
		||||
      @set['bar'].description.should == "tobina"
 | 
			
		||||
 | 
			
		||||
      @set.run_command @ctx, 'bar'
 | 
			
		||||
      run.should == true
 | 
			
		||||
| 
						 | 
				
			
			@ -213,8 +213,8 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command(/^foo1/, 'stuff', :listing => 'foo') { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command 'bar', 'foo1'
 | 
			
		||||
      @set.commands['bar'].match.should == 'bar'
 | 
			
		||||
      @set.commands['bar'].description.should == 'Alias for `foo1`'
 | 
			
		||||
      @set['bar'].match.should == 'bar'
 | 
			
		||||
      @set['bar'].description.should == 'Alias for `foo1`'
 | 
			
		||||
 | 
			
		||||
      @set.run_command @ctx, 'bar'
 | 
			
		||||
      run.should == true
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +225,7 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command(/^foo1/, 'stuff', :listing => 'foo') { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command /^b.r/, 'foo1', :listing => "bar"
 | 
			
		||||
      @set.commands[/^b.r/].options[:listing].should == "bar"
 | 
			
		||||
      @set.to_hash[/^b.r/].options[:listing].should == "bar"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "should set description to default if description parameter is nil" do
 | 
			
		||||
| 
						 | 
				
			
			@ -233,7 +233,7 @@ describe Pry::CommandSet do
 | 
			
		|||
      @set.command(/^foo1/, 'stuff', :listing => 'foo') { run = true }
 | 
			
		||||
 | 
			
		||||
      @set.alias_command "bar", 'foo1'
 | 
			
		||||
      @set.commands["bar"].description.should == "Alias for `foo1`"
 | 
			
		||||
      @set["bar"].description.should == "Alias for `foo1`"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -241,7 +241,7 @@ describe Pry::CommandSet do
 | 
			
		|||
    @set.command('foo', 'bar') {}
 | 
			
		||||
    @set.desc 'foo', 'baz'
 | 
			
		||||
 | 
			
		||||
    @set.commands['foo'].description.should == 'baz'
 | 
			
		||||
    @set['foo'].description.should == 'baz'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should get the descriptions of commands' do
 | 
			
		||||
| 
						 | 
				
			
			@ -327,12 +327,12 @@ describe Pry::CommandSet do
 | 
			
		|||
 | 
			
		||||
  it 'should provide a :listing for a command that defaults to its name' do
 | 
			
		||||
    @set.command 'foo', "" do;end
 | 
			
		||||
    @set.commands['foo'].options[:listing].should == 'foo'
 | 
			
		||||
    @set['foo'].options[:listing].should == 'foo'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should provide a :listing for a command that differs from its name' do
 | 
			
		||||
    @set.command 'foo', "", :listing => 'bar' do;end
 | 
			
		||||
    @set.commands['foo'].options[:listing].should == 'bar'
 | 
			
		||||
    @set['foo'].options[:listing].should == 'bar'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "should provide a 'help' command" do
 | 
			
		||||
| 
						 | 
				
			
			@ -377,9 +377,9 @@ describe Pry::CommandSet do
 | 
			
		|||
      listing = "bing"
 | 
			
		||||
      @set.command('foo') { }
 | 
			
		||||
      @set.rename_command('bar', 'foo', :description => desc, :listing => listing, :keep_retval => true)
 | 
			
		||||
      @set.commands['bar'].description.should           == desc
 | 
			
		||||
      @set.commands['bar'].options[:listing].should     == listing
 | 
			
		||||
      @set.commands['bar'].options[:keep_retval].should == true
 | 
			
		||||
      @set['bar'].description.should           == desc
 | 
			
		||||
      @set['bar'].options[:listing].should     == listing
 | 
			
		||||
      @set['bar'].options[:keep_retval].should == true
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ describe "Pry::Command" do
 | 
			
		|||
        #
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      mock_command(@set.commands['help'], %w(oolon-colluphid), :command_set => @set).output.should =~ /Raving Atheist/
 | 
			
		||||
      mock_command(@set['help'], %w(oolon-colluphid), :command_set => @set).output.should =~ /Raving Atheist/
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should use slop to generate the help for classy commands' do
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ describe "Pry::Command" do
 | 
			
		|||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      mock_command(@set.commands['help'], %w(eddie), :command_set => @set).output.should =~ /Over-cheerful/
 | 
			
		||||
      mock_command(@set['help'], %w(eddie), :command_set => @set).output.should =~ /Over-cheerful/
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should provide --help for classy commands' do
 | 
			
		||||
| 
						 | 
				
			
			@ -803,17 +803,17 @@ describe "Pry::Command" do
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should be correct for default commands' do
 | 
			
		||||
      @set.commands["help"].group.should == "Help"
 | 
			
		||||
      @set["help"].group.should == "Help"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should not change once it is initialized' do
 | 
			
		||||
      @set.commands["magic"].group("-==CD COMMAND==-")
 | 
			
		||||
      @set.commands["magic"].group.should == "Not for a public use"
 | 
			
		||||
      @set["magic"].group("-==CD COMMAND==-")
 | 
			
		||||
      @set["magic"].group.should == "Not for a public use"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should not disappear after the call without parameters' do
 | 
			
		||||
      @set.commands["magic"].group
 | 
			
		||||
      @set.commands["magic"].group.should == "Not for a public use"
 | 
			
		||||
      @set["magic"].group
 | 
			
		||||
      @set["magic"].group.should == "Not for a public use"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue