You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1007 B

  1. require 'rails_helper'
  2. RSpec.describe HomeController, type: :controller do
  3. render_views
  4. describe 'GET #index' do
  5. context 'when not signed in' do
  6. it 'redirects to about page' do
  7. get :index
  8. expect(response).to redirect_to(about_path)
  9. end
  10. end
  11. context 'when signed in' do
  12. let(:user) { Fabricate(:user) }
  13. subject do
  14. sign_in(user)
  15. get :index
  16. end
  17. it 'assigns @body_classes' do
  18. subject
  19. expect(assigns(:body_classes)).to eq 'app-body'
  20. end
  21. it 'assigns @initial_state_json' do
  22. subject
  23. initial_state_json = json_str_to_hash(assigns(:initial_state_json))
  24. expect(initial_state_json[:meta]).to_not be_nil
  25. expect(initial_state_json[:compose]).to_not be_nil
  26. expect(initial_state_json[:accounts]).to_not be_nil
  27. expect(initial_state_json[:settings]).to_not be_nil
  28. expect(initial_state_json[:media_attachments]).to_not be_nil
  29. end
  30. end
  31. end
  32. end