mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 15:08:56 +08:00
4ea21fa2d0
This change both speeds up specs (less strings to allocate) and helps catch cases where methods in Discourse are mutating inputs. Overall we will be migrating everything to use #frozen_string_literal: true it will take a while, but this is the first and safest move in this direction
41 lines
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe AboutController do
|
|
|
|
context '.index' do
|
|
|
|
it "should display the about page for anonymous user when login_required is false" do
|
|
SiteSetting.login_required = false
|
|
get "/about"
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.body).to include("<title>About - Discourse</title>")
|
|
end
|
|
|
|
it 'should redirect to login page for anonymous user when login_required is true' do
|
|
SiteSetting.login_required = true
|
|
get "/about"
|
|
|
|
expect(response).to redirect_to '/login'
|
|
end
|
|
|
|
it "should display the about page for logged in user when login_required is true" do
|
|
SiteSetting.login_required = true
|
|
sign_in(Fabricate(:user))
|
|
get "/about"
|
|
|
|
expect(response.status).to eq(200)
|
|
end
|
|
|
|
context "crawler view" do
|
|
it "should include correct title" do
|
|
get '/about', headers: { 'HTTP_USER_AGENT' => 'Googlebot' }
|
|
expect(response.status).to eq(200)
|
|
expect(response.body).to include("<title>About - Discourse</title>")
|
|
end
|
|
end
|
|
end
|
|
end
|