Sha256: e057cea45f4ae3820dd1ccaa6a80c271f209a51b3e2df1d08993661990b9df8b

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require "./test/helper"

clean_describe "set location" do
  subject { run_cmd("set location #{friend_name} #{location_name}") }
  let(:content) { CONTENT }

  describe "when friend does not exist" do
    let(:friend_name) { "Garbage" }
    let(:location_name) { "Paris" }

    it "prints an error message" do
      stderr_only 'Error: No friend found for "Garbage"'
    end
  end

  describe "when location does not exist" do
    let(:friend_name) { "Marie" }
    let(:location_name) { "Garbage" }

    it "prints an error message" do
      stderr_only 'Error: No location found for "Garbage"'
    end
  end

  describe "when friend and location exist" do
    let(:location_name) { "Paris" }

    describe "when friend already has a location" do
      let(:friend_name) { "Marie" }

      it "prints correct output" do
        stdout_only "Marie Curie's location set to: \"Paris\""
      end

      it "updates existing location" do
        line_changed "- Marie Curie [Atlantis] @science", "- Marie Curie [Paris] @science"
      end
    end

    describe "when friend has no location" do
      let(:friend_name) { "George" }

      it "prints correct output" do
        stdout_only "George Washington Carver's location set to: \"Paris\""
      end

      it "adds a location" do
        line_changed "- George Washington Carver", "- George Washington Carver [Paris]"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friends-0.36 test/commands/set/location_spec.rb