Sha256: 9f7797003173a9c952743eeb02be0a107d217d1510ee9d09be7fdf41d9e71209

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

RSpec.describe "perfmonger command" do
  it "should be an executable" do
    expect(File.executable?(perfmonger_bin)).to be true
  end

  it 'should print help and exit with failure when no arguments given' do
    cmd = "#{perfmonger_bin}"
    run(cmd)
    expect(last_command_started).not_to be_successfully_executed
    expect(last_command_started.stdout).to match(/^Usage: perfmonger/)
  end

  it 'should print help and exit with success when --help is given' do
    ["-h", "--help"].each do |arg|
      cmd = "#{perfmonger_bin} #{arg}"
      run(cmd)
      expect(last_command_started).to be_successfully_executed
      expect(last_command_started.stdout).to match(/^Usage: perfmonger/)
    end
  end

  it 'should print version number if --version given' do
    cmd = "#{perfmonger_bin} --version"
    run(cmd)
    expect(last_command_started).to be_successfully_executed
    expect(last_command_started.stdout).to include(PerfMonger::VERSION)
  end

  it 'fails if unknown subcommand given' do
    cmd = "#{perfmonger_bin} piyo"
    run(cmd)
    expect(last_command_started).not_to be_successfully_executed
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
perfmonger-0.14.4 spec/perfmonger_spec.rb
perfmonger-0.14.2 spec/perfmonger_spec.rb
perfmonger-0.14.1 spec/perfmonger_spec.rb
perfmonger-0.14.0 spec/perfmonger_spec.rb
perfmonger-0.13.1 spec/perfmonger_spec.rb
perfmonger-0.12.1 spec/perfmonger_spec.rb
perfmonger-0.12.0 spec/perfmonger_spec.rb
perfmonger-0.11.2 spec/perfmonger_spec.rb
perfmonger-0.11.1 spec/perfmonger_spec.rb
perfmonger-0.11.0 spec/perfmonger_spec.rb