logstash/qa/rspec/matchers/cli_matchers.rb
Pier-Hugues Pellerin 7b38e798c2 Migration of the CLI script to run under Vagrant VMs.
This is the First pass to add the `integration` test for the CLI, the
Logstash and the logstash-plugin command.

Fixes #5259

Fixes #5350
2016-06-02 14:37:15 +00:00

31 lines
776 B
Ruby

# encoding: utf-8
RSpec::Matchers.define :be_successful do
match do |actual|
actual.exit_status == 0
end
end
RSpec::Matchers.define :fail_and_output do |expected_output|
match do |actual|
actual.exit_status == 1 && actual.stderr =~ expected_output
end
end
RSpec::Matchers.define :run_successfully_and_output do |expected_output|
match do |actual|
(actual.exit_status == 0 || actual.exit_status.nil?) && actual.stdout =~ expected_output
end
end
RSpec::Matchers.define :have_installed? do |name,*args|
match do |actual|
version = args.first
actual.plugin_installed?(name, version)
end
end
RSpec::Matchers.define :install_successfully do
match do |cmd|
expect(cmd).to run_successfully_and_output(/Installation successful/)
end
end