mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-31 19:29:26 -04:00
- Removed unused styles and helper methods from _garden_layout.scss, _homepage.scss, and overrides.scss. - Updated _home_dashboard.scss to enhance button styles and added new harvest picker styles. - Introduced HarvestPicker component for improved harvest recording functionality. - Refactored home dashboard views to utilize new home_section helper for consistent layout. - Simplified and optimized existing methods in application_helper.rb, activity.rb, and harvest.rb. - Removed deprecated homepage_records methods from Activity and Harvest models. - Updated tests to reflect changes in helper methods and removed obsolete tests.
30 lines
863 B
Ruby
30 lines
863 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
# Plantings and harvests are dated, not timed, so "today" must not turn into
|
|
# "19 hours ago" for someone whose midnight was hours back.
|
|
describe HomeHelper do
|
|
include ActiveSupport::Testing::TimeHelpers
|
|
|
|
describe '#ago_in_words' do
|
|
around { |example| travel_to(Time.zone.local(2026, 10, 12, 19, 30)) { example.run } }
|
|
|
|
it 'says today for a date that is today' do
|
|
expect(helper.ago_in_words(Date.current)).to eq 'today'
|
|
end
|
|
|
|
it 'says yesterday' do
|
|
expect(helper.ago_in_words(Date.current - 1)).to eq 'yesterday'
|
|
end
|
|
|
|
it 'counts days for an older date' do
|
|
expect(helper.ago_in_words(Date.current - 5)).to eq '5 days ago'
|
|
end
|
|
|
|
it 'still counts hours for a time' do
|
|
expect(helper.ago_in_words(3.hours.ago)).to eq 'about 3 hours ago'
|
|
end
|
|
end
|
|
end
|