Skip to content

Commit

Permalink
Add CIS2 "change role" button
Browse files Browse the repository at this point in the history
  • Loading branch information
misaka committed Sep 16, 2024
1 parent 2d278f9 commit fe48ecf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/views/application/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
</svg>
<%= current_user.full_name %>
</span>
<% if Flipper.enabled? :cis2 %>
<span class="app-header__account-item">
<%= button_to "Change role", user_cis2_omniauth_authorize_path, class: "app-header__account-button", params: { change_role: true } %>
</span>
<% end %>
<span class="app-header__account-item">
<%= button_to "Log out", destroy_user_session_path,
class: "app-header__account-button", method: :delete %>
Expand Down
11 changes: 11 additions & 0 deletions spec/features/user_cis2_authentication_from_start_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
then_i_see_the_dashboard
and_i_am_logged_in

when_i_click_the_change_role_button
then_i_see_the_dashboard

when_i_log_out
then_i_am_on_the_start_page
and_i_am_logged_out
Expand Down Expand Up @@ -79,6 +82,14 @@ def and_i_am_logged_in
expect(page).to have_button "Log out"
end

def when_i_click_the_change_role_button
click_button "Change role"
end

def then_i_see_the_sessions_page
expect(page).to have_current_path sessions_path
end

def when_i_log_out
click_button "Log out"
end
Expand Down

0 comments on commit fe48ecf

Please sign in to comment.