|
951 | 951 | context 'with response assertions' do |
952 | 952 | it 'registers an offense when using `assert_response`' do |
953 | 953 | expect_offense(<<~RUBY) |
954 | | - assert_response :ok |
955 | | - ^^^^^^^^^^^^^^^^^^^ Use `expect(response).to have_http_status(:ok)`. |
| 954 | + assert_response :redirect |
| 955 | + ^^^^^^^^^^^^^^^^^^^^^^^^^ Use `expect(response).to have_http_status(:redirect)`. |
956 | 956 | RUBY |
957 | 957 |
|
958 | 958 | expect_correction(<<~RUBY) |
959 | | - expect(response).to have_http_status(:ok) |
| 959 | + expect(response).to have_http_status(:redirect) |
| 960 | + RUBY |
| 961 | + end |
| 962 | + |
| 963 | + it 'registers an offense when using `assert_response` with a number' do |
| 964 | + expect_offense(<<~RUBY) |
| 965 | + assert_response 200 |
| 966 | + ^^^^^^^^^^^^^^^^^^^ Use `expect(response).to have_http_status(200)`. |
| 967 | + RUBY |
| 968 | + |
| 969 | + expect_correction(<<~RUBY) |
| 970 | + expect(response).to have_http_status(200) |
960 | 971 | RUBY |
961 | 972 | end |
962 | 973 |
|
963 | 974 | it 'registers an offense when using `assert_response` with parentheses' do |
964 | 975 | expect_offense(<<~RUBY) |
965 | | - assert_response(:ok) |
966 | | - ^^^^^^^^^^^^^^^^^^^^ Use `expect(response).to have_http_status(:ok)`. |
| 976 | + assert_response(:success) |
| 977 | + ^^^^^^^^^^^^^^^^^^^^^^^^^ Use `expect(response).to have_http_status(:success)`. |
967 | 978 | RUBY |
968 | 979 |
|
969 | 980 | expect_correction(<<~RUBY) |
970 | | - expect(response).to have_http_status(:ok) |
| 981 | + expect(response).to have_http_status(:success) |
971 | 982 | RUBY |
972 | 983 | end |
973 | 984 |
|
|
1011 | 1022 | it 'does not register an offense when using ' \ |
1012 | 1023 | '`expect(response).to have_http_status`' do |
1013 | 1024 | expect_no_offenses(<<~RUBY) |
1014 | | - expect(response).to have_http_status(:ok) |
| 1025 | + expect(response).to have_http_status(:success) |
1015 | 1026 | RUBY |
1016 | 1027 | end |
1017 | 1028 |
|
|
0 commit comments