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

35 lines
1.0 KiB
Ruby

# frozen_string_literal: true
describe "Viewing top topics on categories page", type: :system, js: true do
fab!(:user)
let(:category_list) { PageObjects::Components::CategoryList.new }
let(:topic_view) { PageObjects::Components::TopicView.new }
fab!(:category)
fab!(:topic) { Fabricate(:topic, category: category) }
fab!(:post) { Fabricate(:post, topic: topic) }
it "displays and updates new counter" do
skip(<<~TEXT)
Flaky at the following step:
expect(category_list).to have_no_new_posts_badge
expected `#<PageObjects::Components::CategoryList:0x00007fe27a3d2340>.has_no_new_posts_badge?` to be truthy, got false
TEXT
sign_in(user)
visit("/categories")
category_list.click_new_posts_badge(count: 1)
category_list.click_topic(topic)
expect(topic_view).to have_read_post(post)
category_list.click_logo
category_list.click_category_navigation
expect(category_list).to have_category(category)
expect(category_list).to have_no_new_posts_badge
end
end