Sha256: 38fd39eb40bf786c25d772678bd29084c659867cf416490b11abd56e2c227cc8
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
Feature: before_cmd hooks You can configure Aruba to run blocks of code before it runs each command. The command will be passed to the block. Background: Given I use a fixture named "cli-app" Scenario: Run a simple command with a "before(:command)"-hook Given a file named "spec/support/hooks.rb" with: """ Aruba.configure do |config| config.before :command do |cmd| puts "before 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.stdout.chomp).to eq 'running' } end """ When I run `rspec` Then the specs should all pass And the output should contain: """ before the run of `echo running` """ Scenario: Run a simple command with a "before(:cmd)"-hook (deprecated) Given a file named "spec/support/hooks.rb" with: """ Aruba.configure do |config| config.before :cmd do |cmd| puts "before the run of `#{cmd}`" 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.stdout.chomp).to eq 'running' } end """ When I run `rspec` Then the specs should all pass And the output should contain: """ before the run of `echo running` """
Version data entries
6 entries across 6 versions & 1 rubygems