home_controller_spec.rb 736 B

1234567891011121314151617181920212223242526272829303132
  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. before { @request.path = '/web/timelines/tag/name' }
  9. it { is_expected.to redirect_to '/tags/name' }
  10. end
  11. it 'redirects to about page' do
  12. @request.path = '/'
  13. is_expected.to redirect_to(about_path)
  14. end
  15. end
  16. context 'when signed in' do
  17. let(:user) { Fabricate(:user) }
  18. before { sign_in(user) }
  19. it 'assigns @body_classes' do
  20. subject
  21. expect(assigns(:body_classes)).to eq 'app-body'
  22. end
  23. end
  24. end
  25. end