Class: Brut::SpecSupport::CLICommandSupport::CapturingExecutor

Inherits:
CLI::Executor
  • Object
show all
Defined in:
lib/brut/spec_support/cli_command_support.rb

Overview

A subclass of CLI::Executor that remembers the commands it was asked to execute, instead of actually executing them. This allows inspection later to see if expected commands had been run.

This is used by the have_executed matcher.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CLI::Executor

#initialize, #system

Constructor Details

This class inherits a constructor from Brut::CLI::Executor

Instance Attribute Details

#commands_executedObject (readonly)

Returns the value of attribute commands_executed.



12
13
14
# File 'lib/brut/spec_support/cli_command_support.rb', line 12

def commands_executed
  @commands_executed
end

Instance Method Details

#system!(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/brut/spec_support/cli_command_support.rb', line 13

def system!(*args)
  @commands_executed ||= []
  if args.length == 1
    @commands_executed << args[0]
  else
    @commands_executed << args
  end
  nil
end