LoginSignup
0
0

More than 5 years have passed since last update.

Aruba gem - Hooks

Posted at

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

外部資料

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0