Sha256: 9eb532e80319aa2a02b72a402b6fcb43098b2e88cc4628386e283e217b62e6ad

Contents?: true

Size: 924 Bytes

Versions: 18

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true

require "./test/helper"

clean_describe "add location" do
  subject { run_cmd("add location #{location_name}") }

  let(:content) { CONTENT }

  describe "when location name is blank" do
    let(:location_name) { "' '" }

    it "prints an error message" do
      stderr_only 'Error: Expected "[Location Name]"'
    end
  end

  describe "when there is an existing location with that name" do
    let(:location_name) { "Paris" }

    it "prints an error message" do
      stderr_only 'Error: Location "Paris" already exists'
    end
  end

  describe "when there is no existing location with that name" do
    # This also tests that we can use multi-word names without quotes.
    let(:location_name) { "New England" }

    it "adds location" do
      line_added "- New England"
    end

    it "prints an output message" do
      stdout_only 'Location added: "New England"'
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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