mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 11:41:03 +08:00
tos and privacy urls redirect based on site settings
This commit is contained in:
@ -17,6 +17,26 @@ describe StaticController do
|
||||
end
|
||||
end
|
||||
|
||||
[ ['tos', :tos_url], ['privacy', :privacy_policy_url] ].each do |id, setting_name|
|
||||
context "#{id}" do
|
||||
subject { xhr :get, :show, id: id }
|
||||
|
||||
context "when #{setting_name} site setting is NOT set" do
|
||||
it "renders the #{id} page" do
|
||||
expect(subject).to render_template(id)
|
||||
end
|
||||
end
|
||||
|
||||
context "when #{setting_name} site setting is set" do
|
||||
before { SiteSetting.stubs(setting_name).returns('http://example.com/page') }
|
||||
|
||||
it "redirects to the #{setting_name}" do
|
||||
expect(subject).to redirect_to('http://example.com/page')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a missing file" do
|
||||
it "should respond 404" do
|
||||
xhr :get, :show, id: 'does-not-exist'
|
||||
|
Reference in New Issue
Block a user