home_controller_spec.rb 784 B

12345678910111213141516171819202122232425262728293031323334
  1. require 'rails_helper'
  2. RSpec.describe HomeController, type: :controller do
  3. render_views
  4. describe 'GET #index' do
  5. subject { get :index }
  6. context 'when not signed in' do
  7. context 'when requested path is tag timeline' do
  8. it 'redirects to the tag\'s permalink' do
  9. @request.path = '/web/timelines/tag/name'
  10. is_expected.to redirect_to '/tags/name'
  11. end
  12. end
  13. it 'redirects to about page' do
  14. @request.path = '/'
  15. is_expected.to redirect_to(about_path)
  16. end
  17. end
  18. context 'when signed in' do
  19. let(:user) { Fabricate(:user) }
  20. before { sign_in(user) }
  21. it 'assigns @body_classes' do
  22. subject
  23. expect(assigns(:body_classes)).to eq 'app-body'
  24. end
  25. end
  26. end
  27. end