mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
1eb70973a2
This PR adds a theme modifier and route so that custom themes can opt to show their own homepage. See PR description for example usage.
29 lines
902 B
Ruby
29 lines
902 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe HomepageHelper do
|
|
describe "resolver" do
|
|
fab!(:user)
|
|
|
|
it "returns latest by default" do
|
|
expect(HomepageHelper.resolve).to eq("latest")
|
|
end
|
|
|
|
it "returns custom when theme has a custom homepage" do
|
|
ThemeModifierHelper.any_instance.expects(:custom_homepage).returns(true)
|
|
|
|
expect(HomepageHelper.resolve).to eq("custom")
|
|
end
|
|
|
|
context "when first item in top menu is no valid for anons" do
|
|
it "distinguishes between auth homepage and anon homepage" do
|
|
SiteSetting.top_menu = "new|top|latest|unread"
|
|
|
|
expect(HomepageHelper.resolve(nil, user)).to eq("new")
|
|
# new is not a valid route for anon users, anon homepage is next item, top
|
|
expect(HomepageHelper.resolve).to eq(SiteSetting.anonymous_homepage)
|
|
expect(HomepageHelper.resolve).to eq("top")
|
|
end
|
|
end
|
|
end
|
|
end
|