mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
978785720a
If we do not do this, then people that login from /login will just be redirected back to the login page. We'd rather have them see the root path.
49 lines
1.1 KiB
Ruby
49 lines
1.1 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe StaticController do
|
|
|
|
context "with a static file that's present" do
|
|
|
|
before do
|
|
xhr :get, :show, id: 'faq'
|
|
end
|
|
|
|
it 'renders the static file if present' do
|
|
response.should be_success
|
|
end
|
|
|
|
it "renders the file" do
|
|
response.should render_template('faq')
|
|
end
|
|
end
|
|
|
|
context "with a missing file" do
|
|
it "should respond 404" do
|
|
xhr :get, :show, id: 'does-not-exist'
|
|
response.response_code.should == 404
|
|
end
|
|
end
|
|
|
|
describe '#enter' do
|
|
context 'without a redirect path' do
|
|
it 'redirects to the root url' do
|
|
xhr :post, :enter
|
|
expect(response).to redirect_to root_path
|
|
end
|
|
end
|
|
|
|
context 'with a redirect path' do
|
|
it 'redirects to the redirect path' do
|
|
xhr :post, :enter, redirect: '/foo'
|
|
expect(response).to redirect_to '/foo'
|
|
end
|
|
end
|
|
|
|
context 'when the redirect path is the login page' do
|
|
it 'redirects to the root url' do
|
|
xhr :post, :enter, redirect: login_path
|
|
expect(response).to redirect_to root_path
|
|
end
|
|
end
|
|
end
|
|
end
|