mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:40:01 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
36 lines
942 B
Ruby
36 lines
942 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::BumpTopic do
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
fab!(:user) { Fabricate(:user) }
|
|
|
|
it "can bump a topic" do
|
|
topic = Fabricate(:topic_timer, user: admin).topic
|
|
create_post(topic: topic)
|
|
|
|
freeze_time (2.hours.from_now)
|
|
|
|
expect do
|
|
described_class.new.execute(topic_timer_id: topic.public_topic_timer.id)
|
|
end.to change { topic.posts.count }.by (1)
|
|
|
|
expect(topic.reload.public_topic_timer).to eq(nil)
|
|
end
|
|
|
|
it "respects the guardian" do
|
|
topic = Fabricate(:topic_timer, user: user).topic
|
|
create_post(topic: topic)
|
|
topic.category = Fabricate(:private_category, group: Fabricate(:group))
|
|
topic.save!
|
|
|
|
freeze_time (2.hours.from_now)
|
|
|
|
expect do
|
|
described_class.new.execute(topic_timer_id: topic.public_topic_timer.id)
|
|
end.to change { topic.posts.count }.by (0)
|
|
|
|
expect(topic.reload.public_topic_timer).to eq(nil)
|
|
end
|
|
|
|
end
|