Sha256: 697090cf206ec76f36505eb41ef2bd54728e53d14c4e7a72d6d60ac144385d4d

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'
require 'ronin/ui/cli/cli'

describe UI::CLI do
  describe "commands" do
    subject { described_class.commands }

    it { should_not be_empty }

    it "should replace '/' characters with a ':'" do
      expect(subject.all? { |command| command.include?('/') }).to be(false)
    end
  end

  describe "command" do
    it "should load classes from 'ronin/ui/cli/commands/'" do
      command = subject.command('help')
      
      expect(command.name).to eq('Ronin::UI::CLI::Commands::Help')
    end

    it "should load classes from namespaces within 'ronin/ui/cli/commands/'" do
      command = subject.command('net:proxy')
      
      expect(command.name).to eq('Ronin::UI::CLI::Commands::Net::Proxy')
    end

    it "should raise UnknownCommand for unknown commands" do
      expect {
        subject.command('foo')
      }.to raise_error(described_class::UnknownCommand)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-1.5.1 spec/ui/cli/cli_spec.rb