Sha256: a008b91ffe0af5937bcb11f2fb704fa68daa96e3fbeef8a3cb827aa23dbb77c6

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

Feature: After command hooks

  You can configure Aruba to run blocks of code after it has run
  a command. The command will be passed to the block.

  You can hook into Aruba's lifecycle just before it runs a command and after it has run the command:

  ```ruby
  Aruba.configure do |config|
    config.after :command do |cmd|
      puts "After the run of '#{cmd}'"
    end
  end
  ```

  Background:
    Given I use a fixture named "cli-app"

  Scenario: Run a simple command with an "after(:command)"-hook
    Given a file named "spec/support/hooks.rb" with:
    """
    require 'aruba'

    Aruba.configure do |config|
      config.after :command do |cmd|
        puts "after the run of `#{cmd.commandline}`"
      end
    end
    """
    And a file named "spec/hook_spec.rb" with:
    """
    require 'spec_helper'

    RSpec.describe 'Hooks', :type => :aruba do
      before(:each) { run_simple 'echo running' }

      it { expect(last_command_started.stdout.chomp).to eq 'running' }
    end
    """
    When I run `rspec`
    Then the specs should all pass
    And the output should contain:
    """
    after the run of `echo running`
    """

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aruba-0.14.7 features/hooks/after/command.feature
aruba-0.14.6 features/hooks/after/command.feature
aruba-0.14.5 features/hooks/after/command.feature
aruba-0.14.4 features/hooks/after/command.feature
aruba-0.14.3 features/hooks/after/command.feature