DEV: uses context blocks (#28658)
This commit is contained in:
parent
d81fc1448b
commit
b0059c735c
|
@ -8,10 +8,25 @@ RSpec.describe HomepageHelper 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)
|
||||
context "when theme has a custom homepage" do
|
||||
before { ThemeModifierHelper.any_instance.expects(:custom_homepage).returns(true) }
|
||||
|
||||
expect(HomepageHelper.resolve).to eq("custom")
|
||||
it "returns custom" do
|
||||
expect(HomepageHelper.resolve).to eq("custom")
|
||||
end
|
||||
end
|
||||
|
||||
context "when a plugin modifies the custom_homepage_enabled to true" do
|
||||
before do
|
||||
DiscoursePluginRegistry
|
||||
.expects(:apply_modifier)
|
||||
.with(:custom_homepage_enabled, false, request: nil, current_user: nil)
|
||||
.returns(true)
|
||||
end
|
||||
|
||||
it "returns custom" do
|
||||
expect(HomepageHelper.resolve).to eq("custom")
|
||||
end
|
||||
end
|
||||
|
||||
it "returns custom when a plugin modifies the custom_homepage_enabled to true" do
|
||||
|
@ -24,9 +39,9 @@ RSpec.describe HomepageHelper do
|
|||
end
|
||||
|
||||
context "when first item in top menu is not valid for anons" do
|
||||
it "distinguishes between auth homepage and anon homepage" do
|
||||
SiteSetting.top_menu = "new|top|latest|unread"
|
||||
before { SiteSetting.top_menu = "new|top|latest|unread" }
|
||||
|
||||
it "distinguishes between auth homepage and anon homepage" do
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue