|
26 | 26 | context 'with authenticated user', :as_user do |
27 | 27 | it 'automatically authenticates as regular user' do |
28 | 28 | # This would test user-accessible endpoints |
29 | | - expect(response).to be_nil # Just showing the setup works |
| 29 | + # Test that we can access a user-accessible endpoint |
| 30 | + get better_together.conversations_path(locale:) |
| 31 | + expect(response).to have_http_status(:ok) |
| 32 | + # Verify session contains user information |
| 33 | + expect(session['warden.user.user.key']).to be_present |
30 | 34 | end |
31 | 35 | end |
32 | 36 |
|
33 | 37 | # Example 4: Unauthenticated tests |
34 | 38 | context 'without authentication', :no_auth do |
35 | 39 | it 'remains unauthenticated' do |
36 | 40 | # This would test public endpoints |
37 | | - expect(response).to be_nil # Just showing the setup works |
| 41 | + # Test a simple endpoint that should redirect to login when not authenticated |
| 42 | + # Use a path that exists regardless of host setup |
| 43 | + get better_together.new_user_session_path(locale:) |
| 44 | + expect(response).to have_http_status(:ok) # Login page should be accessible |
| 45 | + expect(response.body).to include('Sign In') # Should show login form |
38 | 46 | end |
39 | 47 | end |
40 | 48 |
|
41 | 49 | # Example 5: Skip host platform setup (for testing setup wizard) |
42 | 50 | context 'without host platform setup', :skip_host_setup do |
43 | 51 | it 'skips automatic host platform configuration' do |
44 | 52 | # This would test the host setup wizard or similar flows |
45 | | - expect(response).to be_nil # Just showing the setup works |
| 53 | + # Just verify the metadata worked |
| 54 | + expect(RSpec.current_example.metadata[:skip_host_setup]).to be true |
46 | 55 | end |
47 | 56 | end |
48 | 57 | end |
0 commit comments