Sha256: cceaf69539e0589c93a010e874e98ac66d7590edb66e9ebbe23dc17fec9efdc6

Contents?: true

Size: 1023 Bytes

Versions: 4

Compression:

Stored size: 1023 Bytes

Contents

describe JekyllSort::CLI do
  before(:all) do
    @args = "--from Tung"
  end

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

    it "goodbye" do
      out = execute("exe/jekyll-sort 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/jekyll-sort completion #{command}")
        expect(out).to include(expected_word) # only checking for one word for simplicity
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-sort-0.3.1 spec/lib/cli_spec.rb
jekyll-sort-0.3.0 spec/lib/cli_spec.rb
jekyll-sort-0.2.0 spec/lib/cli_spec.rb
jekyll-sort-0.1.0 spec/lib/cli_spec.rb