discourse/spec/system/groups/group_members_spec.rb
Daniel Waterworth 6e161d3e75
DEV: Allow fab! without block (#24314)
The most common thing that we do with fab! is:

    fab!(:thing) { Fabricate(:thing) }

This commit adds a shorthand for this which is just simply:

    fab!(:thing)

i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
2023-11-09 16:47:59 -06:00

26 lines
726 B
Ruby

# frozen_string_literal: true
describe "Group members", type: :system do
let(:group_page) { PageObjects::Pages::Group.new }
fab!(:admin)
fab!(:group)
before { sign_in(admin) }
describe "adds a user to the group" do
it "should show that the user is already in the group" do
group_page.visit(group).add_users.select_user_and_add(admin)
expect(
group_page.find(".group-members .directory-table__cell--username.group-member .username"),
).to have_text(admin.username)
group_page.add_users.select_user_and_add(admin)
expect(page.find(".modal-container #modal-alert")).to have_text(
"'#{admin.username}' is already a member of this group",
)
end
end
end