Sha256: fb2c7dbc860262cef2f72d26f65ccffa2115315458ceb69a9a6be87f803ccb93

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Apiary::CLI do
  # Don't let Thor fold or truncate lines
  ENV['THOR_COLUMNS'] = '1000'

  # The documentation that ought to match the code
  READMETEXT = open('README.md', &:read)

  it 'has help' do
    help = open('|ruby bin/apiary help', &:read)
    expect(help).to include('Commands:')
    expect(help.lines.count).to be >= 5
  end

  it 'has README.md' do
    expect(READMETEXT).to include('apiary help')
    expect(READMETEXT.lines.count).to be >= 5
  end

  # Confirm that all subcommands are documented, verbatim
  ([''] + (open('|ruby bin/apiary help', 'r', &:readlines)
            .map { |l| /^ +apiary / =~ l ? l : nil }
            .map { |l| /^ *apiary help/ =~ l ? nil : l }
            .compact
            .map { |l| /^ *apiary ([^ ]*)/.match(l)[1] + ' ' }
          )
  ).each do |cmd|
    it "includes help #{cmd}in README.md" do
      puts cmd
      helptext = open("|ruby bin/apiary help #{cmd}", &:read)

      expect(helptext).to include("apiary #{cmd.strip}")
      expect(READMETEXT).to include("apiary #{cmd.strip}")
      expect(READMETEXT).to include(helptext)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
apiaryio-0.17.0 spec/apiary/cli_spec.rb
apiaryio-0.16.1 spec/apiary/cli_spec.rb
apiaryio-0.16.0 spec/apiary/cli_spec.rb
apiaryio-0.15.2 spec/apiary/cli_spec.rb
apiaryio-0.15.1 spec/apiary/cli_spec.rb
apiaryio-0.15.0 spec/apiary/cli_spec.rb
apiaryio-0.14.1 spec/apiary/cli_spec.rb
apiaryio-0.14.0 spec/apiary/cli_spec.rb
apiaryio-0.13.0 spec/apiary/cli_spec.rb
apiaryio-0.12.0 spec/apiary/cli_spec.rb
apiaryio-0.11.1 spec/apiary/cli_spec.rb
apiaryio-0.11.0 spec/apiary/cli_spec.rb
apiaryio-0.10.2 spec/apiary/cli_spec.rb
apiaryio-0.10.1 spec/apiary/cli_spec.rb
apiaryio-0.9.1 spec/apiary/cli_spec.rb
apiaryio-0.9.0 spec/apiary/cli_spec.rb
apiaryio-0.8.1 spec/apiary/cli_spec.rb
apiaryio-0.8.0 spec/apiary/cli_spec.rb
apiaryio-0.7.0 spec/apiary/cli_spec.rb
apiaryio-0.6.1 spec/apiary/cli_spec.rb