|
29 | 29 |
|
30 | 30 | describe "accessing" do |
31 | 31 | before do |
32 | | - get :index |
| 32 | + get :new |
33 | 33 | end |
34 | 34 |
|
35 | 35 | context "when not logged in" do |
|
38 | 38 |
|
39 | 39 | it "does not give access" do |
40 | 40 | expect(response).to be_redirect |
41 | | - expect(response).to redirect_to signin_path(back_url: my_2fa_devices_url) |
| 41 | + expect(response).to redirect_to signin_path(back_url: new_my_2fa_device_url) |
42 | 42 | end |
43 | 43 | end |
44 | 44 |
|
|
51 | 51 | context "when logged in and active strategies" do |
52 | 52 | let(:active_strategies) { [:developer] } |
53 | 53 |
|
54 | | - it "renders the index page" do |
| 54 | + it "renders the new type selection page" do |
55 | 55 | expect(response).to be_successful |
56 | | - expect(response).to render_template "index" |
| 56 | + expect(response).to render_template "new_type" |
57 | 57 | end |
58 | 58 | end |
59 | 59 | end |
|
149 | 149 | .and_return(ServiceResult.failure) |
150 | 150 |
|
151 | 151 | get :confirm, params: { device_id: device.id } |
152 | | - expect(response).to redirect_to action: :index |
| 152 | + expect(response).to redirect_to my_security_path |
153 | 153 | expect(flash[:error]).to include I18n.t("two_factor_authentication.devices.confirm_send_failed") |
154 | 154 | end |
155 | 155 | end |
|
167 | 167 |
|
168 | 168 | it "renders a 400 on missing token" do |
169 | 169 | post :confirm, params: { device_id: device.id } |
170 | | - expect(response).to redirect_to action: :index |
| 170 | + expect(response).to redirect_to my_security_path |
171 | 171 | end |
172 | 172 |
|
173 | 173 | it "redirects to the confirmation on faulty entry" do |
|
192 | 192 | .and_return(ServiceResult.success) |
193 | 193 |
|
194 | 194 | post :confirm, params: { device_id: device.id, otp: "1234" } |
195 | | - expect(response).to redirect_to action: :index |
| 195 | + expect(response).to redirect_to my_security_path |
196 | 196 | expect(flash[:notice]).to include I18n.t("two_factor_authentication.devices.registration_complete") |
197 | 197 | device.reload |
198 | 198 | expect(device.active).to be true |
|
212 | 212 | # rubocop:enable RSpec/AnyInstance |
213 | 213 |
|
214 | 214 | post :confirm, params: { device_id: device.id, otp: "1234" } |
215 | | - expect(response).to redirect_to action: :index |
| 215 | + expect(response).to redirect_to my_security_path |
216 | 216 | expect(flash[:notice]).to include I18n.t("two_factor_authentication.devices.registration_complete") |
217 | 217 | device.reload |
218 | 218 | expect(device.active).to be true |
|
241 | 241 |
|
242 | 242 | it "deletes it" do |
243 | 243 | delete :destroy, params: { device_id: device.id } |
244 | | - expect(response).to redirect_to action: :index |
| 244 | + expect(response).to redirect_to my_security_path |
245 | 245 | expect(user.otp_devices.reload).to eq [] |
246 | 246 | end |
247 | 247 | end |
|
251 | 251 |
|
252 | 252 | it "deletes it" do |
253 | 253 | delete :destroy, params: { device_id: device.id } |
254 | | - expect(response).to redirect_to action: :index |
| 254 | + expect(response).to redirect_to my_security_path |
255 | 255 | expect(user.otp_devices.reload).to eq [] |
256 | 256 | end |
257 | 257 | end |
|
0 commit comments