|
52 | 52 |
|
53 | 53 | visit instruction_authorization_request_path(authorization_request)
|
54 | 54 | else
|
55 |
| - authorization_request = create_authorization_requests_with_status(type, status, 1, current_user).first |
| 55 | + authorization_request = create_authorization_requests_with_status(type, status, 1, applicant: current_user).first |
56 | 56 |
|
57 | 57 | visit authorization_request_path(authorization_request)
|
58 | 58 | end
|
59 | 59 | end
|
60 | 60 |
|
61 |
| -# https://rubular.com/r/AiBmvod6e8ssvO |
62 |
| -Quand(/(j'ai|il y a) (\d+) demandes? d'habilitation "([^"]+)" ?(?:en )?(.+)?/) do |who, count, type, status| |
63 |
| - applicant = who == 'j\'ai' ? current_user : nil |
64 |
| - create_authorization_requests_with_status(type, status, count, applicant) |
| 61 | +# https://rubular.com/r/t8v2hsttNnb9h3 |
| 62 | +Quand(/(j'ai|il y a|mon organisation a) (\d+) demandes? d'habilitation "([^"]+)" ?(?:en )?(.+)?/) do |who, count, type, status| |
| 63 | + applicant = case who |
| 64 | + when 'j\'ai' |
| 65 | + current_user |
| 66 | + when 'mon organisation a' |
| 67 | + create(:user, current_organization: current_user.current_organization) |
| 68 | + end |
| 69 | + |
| 70 | + create_authorization_requests_with_status(type, status, count, applicant:) |
| 71 | +end |
| 72 | + |
| 73 | +Quand(/je suis mentionné dans (\d+) demandes? d'habilitation "([^"]+)" en tant que "([^"]+)"/) do |count, type, role_humanized| |
| 74 | + role = role_humanized.parameterize.underscore |
| 75 | + options = { |
| 76 | + "#{role}_email": current_user.email, |
| 77 | + } |
| 78 | + |
| 79 | + create_authorization_requests_with_status(type, nil, count, options) |
65 | 80 | end
|
66 | 81 |
|
67 | 82 | # https://rubular.com/r/dRUFmK5dzDpjJv
|
|
0 commit comments