mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 07:18:17 +08:00
6e161d3e75
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.
22 lines
754 B
Ruby
22 lines
754 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Admin User Badges Page", type: :system do
|
|
before { SiteSetting.enable_badges = true }
|
|
|
|
fab!(:granter) { Fabricate(:admin) }
|
|
fab!(:user)
|
|
fab!(:badge) { Fabricate(:manually_grantable_badge) }
|
|
let(:user_badges_page) { PageObjects::Pages::AdminUserBadges.new }
|
|
|
|
before { sign_in(granter) }
|
|
|
|
it "displays badge granter and links to their profile" do
|
|
BadgeGranter.grant(badge, user, granted_by: granter)
|
|
badge_row = user_badges_page.visit_page(user).find_badge_row_by_granter(granter)
|
|
expect(badge_row).to have_css("[data-badge-name='#{badge.name}']")
|
|
|
|
badge_row.click_link(granter.username)
|
|
expect(page).to have_current_path "/admin/users/#{granter.id}/#{granter.username}"
|
|
end
|
|
end
|