Sha256: c06d019633612530b3f14d72d5ed25b05685c46fff93ff113897b7c35e1bc4a8

Contents?: true

Size: 1.43 KB

Versions: 8

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

require "./test/helper"

# Since this touches the ~/friends.md file instead of a temp
# one, we only want to run it on our CI servers.
if ENV["TRAVIS"] == "true"
  describe "default filename behavior" do
    let(:filename) { File.expand_path("~/friends.md") }

    after { File.delete(filename) }

    # Since the filename is the system-wide one, we can't have
    # more than one test that touches it, because multiple
    # tests can run in parallel and might stomp on one another.
    # Instead, we just run one test that exercises a lot.
    # This test specifically checks for regressions akin to
    # https://github.com/JacobEvelyn/friends/issues/231
    it "creates a new file and adds to it multiple times" do
      # File does not exist at first.
      value(File.exist?(filename)).must_equal false

      `bundle exec bin/friends add friend Mohandas Karamchand Gandhi`
      `bundle exec bin/friends add friend Sojourner Truth`
      `bundle exec bin/friends add activity 1859-11-30: Lunch with **Harriet Tubman** in _Auburn_.`
      `bundle exec bin/friends add note "1851-05-29: Sojourner Truth's speech"`

      value(File.read(filename)).must_equal <<-FILE
### Activities:
- 1859-11-30: Lunch with **Harriet Tubman** in _Auburn_.

### Notes:
- 1851-05-29: **Sojourner Truth**'s speech

### Friends:
- Harriet Tubman
- Mohandas Karamchand Gandhi
- Sojourner Truth

### Locations:
- Auburn
      FILE
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
friends-0.54 test/default_file_spec.rb
friends-0.53 test/default_file_spec.rb
friends-0.52 test/default_file_spec.rb
friends-0.51 test/default_file_spec.rb
friends-0.50 test/default_file_spec.rb
friends-0.49 test/default_file_spec.rb
friends-0.48 test/default_file_spec.rb
friends-0.47 test/default_file_spec.rb