Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change button from 'Promote to Admin' to 'Edit User' #4701

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/views/users/_organization_user.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
<ul class="dropdown-menu">
<li>
<%=
edit_button_to(
promote_to_org_admin_organization_path(user_id: user.id),
{text: 'Promote to Admin'},
{method: :post, rel: "nofollow", data: {confirm: 'This will promote the user to admin status. Are you sure that you want to submit this?', size: 'xs'}}
)
edit_button_to(
edit_admin_user_path(user),
{text: 'Edit User'}
)
%>
</li>
<li>
Expand Down
12 changes: 12 additions & 0 deletions spec/system/admin/organizations_system_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
RSpec.describe "Admin Organization Management", type: :system, js: true, seed_items: false do
include ActionView::RecordIdentifier

around do |ex|
Kaminari.config.default_per_page = 3
ex.run
Expand Down Expand Up @@ -151,5 +153,15 @@
expect(page).to have_content("Default email text")
expect(page).to have_content("Users")
end

it "can edit a user within an organization" do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a full system spec for this - you can just validate the button in the HTML in a request spec.

user = create(:user, name: "User to be edited", organization: foo_org)
visit admin_organization_path({id: foo_org.id})

click_button dom_id(user, "dropdownMenu")
click_link "Edit User"

expect(page).to have_content("Editing User #{user.name}")
end
end
end
Loading