Help us understand the problem. What is going on with this article?

Aruba gem - Hooks

More than 3 years have passed since last update.

Aruba の Hooks 周りについてまとめます。
Aruba は Before / After の Hook を持っています。

サンプル

require 'spec_helper'

Aruba.configure do |config|
  config.before :command do |cmd|
    puts "before the run of '#{cmd.commandline}'"
  end

  config.after :command do |cmd|
    puts "after the run of '#{cmd.commandline}'"
  end
end

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

  it { expect(last_command_started.stdout.chomp).to eq 'hoge' }
end
  • 実行結果
$ rspec -fd -c ./spec/configuration//home_directory_spec.rb

before the run of 'echo hoge'
after the run of 'echo hoge'
.

Finished in 0.02064 seconds (files took 0.32232 seconds to load)
1 example, 0 failures

外部資料

tbpgr
Rubyを扱う人事(研修開発、エンジニア採用) Learning Designer。 tbpgr の読み方は(てぃーびー) 個人ブログでも色々と情報を垂れ流してます。 http://tbpgr.hatenablog.com/
http://tbpgr.hatenablog.com/
studist
「伝えることを、もっと簡単に」をミッションにビジュアルSOPマネジメントプラットフォームのBtoB SaaS「Teachme Biz」を開発・運営するスタートアップ
https://medium.com/studist-dev
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away