Sha256: 7086ffa9e8d7d7134e77ebcf5dda7c7852d4fc4ff58b594763b54dde6663edfb

Contents?: true

Size: 2 KB

Versions: 19

Compression:

Stored size: 2 KB

Contents

# frozen_string_literal: true

require "./test/helper"

clean_describe "list tags" do
  subject { run_cmd("list tags") }

  describe "when file does not exist" do
    let(:content) { nil }

    it "does not list anything" do
      stdout_only ""
    end
  end

  describe "when file is empty" do
    let(:content) { "" }

    it "does not list anything" do
      stdout_only ""
    end
  end

  describe "when file has content" do
    # Use scrambled content to differentiate between output that is sorted and output that
    # only reads from the (usually-sorted) file.
    let(:content) { SCRAMBLED_CONTENT }

    it "lists unique tags" do
      stdout_only <<-OUTPUT
@doesnt-trust-computers
@doesnt-trust-computers:military-uses
@food
@navy
@partying
@school
@science
@science:indoors:agronomy-with-hydroponics
@science:outdoors
@science:outdoors:agronomy
      OUTPUT
    end

    describe "--from activities" do
      subject { run_cmd("list tags --from activities") }

      it "lists unique tags from activities" do
        stdout_only <<-OUTPUT
@food
@partying
@science:indoors:agronomy-with-hydroponics
        OUTPUT
      end
    end

    describe "--from notes" do
      subject { run_cmd("list tags --from notes") }

      it "lists unique tags from notes" do
        stdout_only <<-OUTPUT
@navy
@school
        OUTPUT
      end
    end

    describe "--from friends" do
      subject { run_cmd("list tags --from friends") }

      it "lists unique tags from friends" do
        stdout_only <<-OUTPUT
@doesnt-trust-computers
@doesnt-trust-computers:military-uses
@navy
@science
@science:outdoors
@science:outdoors:agronomy
        OUTPUT
      end
    end

    describe "with more than one --from flag" do
      subject { run_cmd("list tags --from friends --from notes") }

      it "lists unique tags from friends and notes" do
        stdout_only <<-OUTPUT
@doesnt-trust-computers
@doesnt-trust-computers:military-uses
@navy
@school
@science
@science:outdoors
@science:outdoors:agronomy
        OUTPUT
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
friends-0.55 test/commands/list/tags_spec.rb
friends-0.54 test/commands/list/tags_spec.rb
friends-0.53 test/commands/list/tags_spec.rb
friends-0.52 test/commands/list/tags_spec.rb
friends-0.51 test/commands/list/tags_spec.rb
friends-0.50 test/commands/list/tags_spec.rb
friends-0.49 test/commands/list/tags_spec.rb
friends-0.48 test/commands/list/tags_spec.rb
friends-0.47 test/commands/list/tags_spec.rb
friends-0.46 test/commands/list/tags_spec.rb
friends-0.45 test/commands/list/tags_spec.rb
friends-0.44 test/commands/list/tags_spec.rb
friends-0.43 test/commands/list/tags_spec.rb
friends-0.42 test/commands/list/tags_spec.rb
friends-0.41 test/commands/list/tags_spec.rb
friends-0.40 test/commands/list/tags_spec.rb
friends-0.39 test/commands/list/tags_spec.rb
friends-0.38 test/commands/list/tags_spec.rb
friends-0.37 test/commands/list/tags_spec.rb