home_controller_spec.rb 568 B

123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe HomeController do
  4. render_views
  5. describe 'GET #index' do
  6. subject { get :index }
  7. context 'when not signed in' do
  8. it 'returns http success' do
  9. @request.path = '/'
  10. expect(subject).to have_http_status(:success)
  11. end
  12. end
  13. context 'when signed in' do
  14. let(:user) { Fabricate(:user) }
  15. before do
  16. sign_in(user)
  17. end
  18. it 'returns http success' do
  19. expect(subject).to have_http_status(:success)
  20. end
  21. end
  22. end
  23. end