Sha256: 9c3f10a1590bd86a7e6b8a35ea74ebc7563c69a6b3166ae17ff32c8e1032b7b4

Contents?: true

Size: 1.42 KB

Versions: 120

Compression:

Stored size: 1.42 KB

Contents

require "appsignal/cli"

describe Appsignal::CLI do
  let(:out_stream) { std_stream }
  let(:output) { out_stream.read }
  let(:cli) { Appsignal::CLI }
  before { allow(Dir).to receive(:pwd).and_return(project_fixture_path) }

  it "should print the help with no arguments, -h and --help" do
    [nil, "-h", "--help"].each do |arg|
      expect do
        capture_stdout(out_stream) do
          cli.run([arg].compact)
        end
      end.to raise_error(SystemExit)

      expect(output).to include "appsignal <command> [options]"
      expect(output).to include \
        "Available commands: demo, diagnose, install"
    end
  end

  it "should print the version with -v and --version" do
    ["-v", "--version"].each do |arg|
      expect do
        capture_stdout(out_stream) do
          cli.run([arg])
        end
      end.to raise_error(SystemExit)

      expect(output).to include "AppSignal"
      expect(output).to include "."
    end
  end

  it "should print a notice if a command does not exist" do
    expect do
      capture_stdout(out_stream) do
        cli.run(["nonsense"])
      end
    end.to raise_error(SystemExit)

    expect(output).to include "Command 'nonsense' does not exist, run " \
      "appsignal -h to see the help"
  end

  describe "diagnose" do
    it "should call Appsignal::Diagnose.install" do
      expect(Appsignal::CLI::Diagnose).to receive(:run)

      cli.run([
        "diagnose"
      ])
    end
  end
end

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
appsignal-4.0.6-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.6 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.5-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.5 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.4-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.4 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.3-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.3 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.2-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.2 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.1-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.1 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.0-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.0 spec/lib/appsignal/cli_spec.rb
appsignal-3.13.1-java spec/lib/appsignal/cli_spec.rb
appsignal-3.13.1 spec/lib/appsignal/cli_spec.rb
appsignal-3.13.1.alpha.1-java spec/lib/appsignal/cli_spec.rb
appsignal-3.13.1.alpha.1 spec/lib/appsignal/cli_spec.rb
appsignal-4.0.0.beta.2-java spec/lib/appsignal/cli_spec.rb
appsignal-4.0.0.beta.2 spec/lib/appsignal/cli_spec.rb