discourse-rewind/spec/system/rewind_tab_spec.rb
Martin Brennan a600db4d06
FIX: Rename Favorite Tags/Categories to Most Viewed Tags/Categories and isRewindActive fixes (#27)
This was confusing people last year, most people assumed it meant
the tags they used the most / categories they posted in the most.
This should clear things up.

Also removes the `isRewindActive` function in favour of
`is_rewind_active`
on the current user, since then we only have one place to check this,
and
it makes testing easier since we don't have to mock browser time.

Finally it moves the route for rewind in the UI to the new route path
format.
2025-11-07 10:20:25 +10:00

41 lines
899 B
Ruby

# frozen_string_literal: true
describe "DiscourseRewind | rewind tab", type: :system do
fab!(:current_user, :user)
before do
SiteSetting.discourse_rewind_enabled = true
sign_in(current_user)
end
context "when in january" do
before { freeze_time DateTime.parse("2022-01-10") }
it "shows the tab" do
visit("/my/activity")
expect(page).to have_selector(".user-nav__activity-rewind")
end
end
context "when in december" do
before { freeze_time DateTime.parse("2022-12-05") }
it "shows the tab" do
visit("/my/activity")
expect(page).to have_selector(".user-nav__activity-rewind")
end
end
context "when in november" do
before { freeze_time DateTime.parse("2022-11-24") }
it "doesn't show the tab" do
visit("/my/activity")
expect(page).to have_no_selector(".user-nav__activity-rewind")
end
end
end