Sha256: 3e4b59c5cffd57a8c9b9e8de346dd207ed72a12b98aadc83a149ff6037a3f733

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require "spec_helper"

describe <%= project_class_name %>::CLI do
  before(:all) do
    @args = "--from Tung"
  end

  describe "<%= project_name %>" do
    it "hello" do
      out = execute("exe/<%= project_name %> hello world #{@args}")
      expect(out).to include("from: Tung\nHello world")
    end

    it "goodbye" do
      out = execute("exe/<%= project_name %> sub goodbye world #{@args}")
      expect(out).to include("from: Tung\nGoodbye world")
    end

    commands = {
      "hell" => "hello",
      "hello" => "name",
      "hello -" =>  "--from",
      "hello name" => "--from",
      "hello name --" => "--from",
      "sub goodb" => "goodbye",
      "sub goodbye" => "name",
      "sub goodbye name" => "--from",
      "sub goodbye name --" => "--from",
      "sub goodbye name --from" => "--help",
    }
    commands.each do |command, expected_word|
      it "completion #{command}" do
        out = execute("exe/<%= project_name %> completion #{command}")
        expect(out).to include(expected_word) # only checking for one word for simplicity
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cli-template-3.5.1 lib/templates/default/spec/lib/cli_spec.rb.tt
cli-template-3.5.0 lib/templates/default/spec/lib/cli_spec.rb.tt
cli-template-3.4.0 lib/templates/default/spec/lib/cli_spec.rb.tt
cli-template-3.3.0 lib/templates/default/spec/lib/cli_spec.rb.tt
cli-template-3.2.0 lib/templates/default/spec/lib/cli_spec.rb.tt