mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 15:43:43 +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.
21 lines
666 B
Ruby
21 lines
666 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Viewing user staff info as an admin", type: :system do
|
|
fab!(:user)
|
|
fab!(:admin)
|
|
let(:user_page) { PageObjects::Pages::User.new }
|
|
|
|
before { sign_in(admin) }
|
|
|
|
context "for warnings" do
|
|
fab!(:topic) { Fabricate(:private_message_topic, user: admin, recipient: user) }
|
|
fab!(:user_warning) { UserWarning.create!(user: user, created_by: admin, topic: topic) }
|
|
|
|
it "should display the right link to user's warnings with the right count in text" do
|
|
user_page.visit(user).click_staff_info_warnings_link(user, warnings_count: 1)
|
|
|
|
expect(user_page).to have_warning_messages_path(user)
|
|
end
|
|
end
|
|
end
|