logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

home_controller_spec.rb (1185B)


  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. it 'assigns @initial_state_json' do
  24. subject
  25. initial_state_json = json_str_to_hash(assigns(:initial_state_json))
  26. expect(initial_state_json[:meta]).to_not be_nil
  27. expect(initial_state_json[:compose]).to_not be_nil
  28. expect(initial_state_json[:accounts]).to_not be_nil
  29. expect(initial_state_json[:settings]).to_not be_nil
  30. expect(initial_state_json[:media_attachments]).to_not be_nil
  31. end
  32. end
  33. end
  34. end