2017-03-08 15:42:24 +08:00
|
|
|
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
|
2017-08-31 12:06:56 +08:00
|
|
|
get :index
|
|
|
|
|
2017-03-08 15:42:24 +08:00
|
|
|
expect(response).to be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should redirect to login page for anonymous user when login_required is true' do
|
|
|
|
SiteSetting.login_required = true
|
2017-08-31 12:06:56 +08:00
|
|
|
get :index
|
|
|
|
|
2017-03-08 15:42:24 +08:00
|
|
|
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
|
|
|
|
log_in
|
2017-08-31 12:06:56 +08:00
|
|
|
get :index
|
|
|
|
|
2017-03-08 15:42:24 +08:00
|
|
|
expect(response).to be_success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|