闭社主体 forked from https://github.com/tootsuite/mastodon
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.

39 lines
1.0 KiB

  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. @request.path = '/'
  8. get :index
  9. expect(response).to redirect_to(about_path)
  10. end
  11. end
  12. context 'when signed in' do
  13. let(:user) { Fabricate(:user) }
  14. subject do
  15. sign_in(user)
  16. get :index
  17. end
  18. it 'assigns @body_classes' do
  19. subject
  20. expect(assigns(:body_classes)).to eq 'app-body'
  21. end
  22. it 'assigns @initial_state_json' do
  23. subject
  24. initial_state_json = json_str_to_hash(assigns(:initial_state_json))
  25. expect(initial_state_json[:meta]).to_not be_nil
  26. expect(initial_state_json[:compose]).to_not be_nil
  27. expect(initial_state_json[:accounts]).to_not be_nil
  28. expect(initial_state_json[:settings]).to_not be_nil
  29. expect(initial_state_json[:media_attachments]).to_not be_nil
  30. end
  31. end
  32. end
  33. end