# frozen_string_literal: true require "date" require "./test/helper" require "./test/add_event_helper" clean_describe "add activity" do let(:content) { CONTENT } describe "date ordering" do let(:content) do <<-FILE ### Activities: - 2018-01-01: Activity one year later. - 2017-01-01: Activity 1. - 2016-01-01: Activity one year earlier. ### Notes: ### Friends: ### Locations: FILE end subject do 4.times do |i| run_cmd("add activity 2017-01-01: Activity #{i + 2}.") end end it "orders dates by insertion time" do subject value(File.read(filename)).must_equal <<-FILE ### Activities: - 2018-01-01: Activity one year later. - 2017-01-01: Activity 5. - 2017-01-01: Activity 4. - 2017-01-01: Activity 3. - 2017-01-01: Activity 2. - 2017-01-01: Activity 1. - 2016-01-01: Activity one year earlier. ### Notes: ### Friends: ### Locations: FILE end end parsing_specs(event: :activity) end