home_controller_spec.rb 548 B

12345678910111213141516171819202122232425262728
  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. it 'returns http success' do
  8. @request.path = '/'
  9. is_expected.to have_http_status(:success)
  10. end
  11. end
  12. context 'when signed in' do
  13. let(:user) { Fabricate(:user) }
  14. before do
  15. sign_in(user)
  16. end
  17. it 'returns http success' do
  18. is_expected.to have_http_status(:success)
  19. end
  20. end
  21. end
  22. end