Sha256: 6d05e4fef239e8713d37dbe203c4b7be81dd451b4e151dedf3c3286ad3b3da69

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require 'open3'

#
module CLISteps
  def _execute(exec)
    Dir.chdir(@__root) do
      Bundler.with_clean_env do
        out, err, status = Open3.capture3('bash', '-lc', exec)

        @last_process = [Integer(status), out, err]
      end
    end
  end

  step(/I execute "(.*?)"/, :_execute)

  step('I execute all scenarios') do
    _execute 'bundle exec gurke'
  end

  step(/the program exit code should be null/) do
    expect(@last_process[0]).to eq 0
  end

  step(/the program exit code should be non-null/) do
    expect(@last_process[0]).to_not eq 0
  end

  def _cli_include_content(content)
    expect(@last_process[1] + @last_process[2]).to include content
  end

  step(/the program output should include "(.*?)"/, :_cli_include_content)

  def _cli_not_include_content(content)
    expect(@last_process[1] + @last_process[2]).to_not include content
  end

  step(/the program output should not include "(.*?)"/,
       :_cli_not_include_content)

  step(/all scenarios have passed/) do
    _cli_include_content 'scenarios: 0 failing, 0 pending'
  end
end

Gurke.config.include CLISteps

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gurke-2.4.2 features/support/steps/cli_steps.rb
gurke-2.4.1 features/support/steps/cli_steps.rb
gurke-2.4.0 features/support/steps/cli_steps.rb