discourse/spec/system/viewing_user_menu_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

34 lines
959 B
Ruby

# frozen_string_literal: true
RSpec.describe "Viewing User Menu", system: true do
fab!(:user)
let(:user_menu) { PageObjects::Components::UserMenu.new }
describe "when viewing replies notifications tab" do
fab!(:topic)
it "should display group mentioned notifications in the tab" do
Jobs.run_immediately!
mentionable_group = Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:everyone])
user_in_mentionable_group = Fabricate(:user).tap { |user| mentionable_group.add(user) }
_post_with_group_mention =
PostCreator.create!(user, topic_id: topic.id, raw: "Hello @#{mentionable_group.name}")
sign_in(user_in_mentionable_group)
visit("/latest")
user_menu.open
expect(user_menu).to have_right_replies_button_count(1)
user_menu.click_replies_notifications_tab
expect(user_menu).to have_group_mentioned_notification(topic, user, mentionable_group)
end
end
end