mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 22:39:36 +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
26 lines
842 B
Ruby
26 lines
842 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ReviewableFlaggedPostSerializer do
|
|
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
|
|
it "includes the user fields for review" do
|
|
p0 = Fabricate(:post)
|
|
reviewable = PostActionCreator.spam(Fabricate(:user), p0).reviewable
|
|
json = ReviewableFlaggedPostSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_json
|
|
expect(json[:cooked]).to eq(p0.cooked)
|
|
expect(json[:raw]).to eq(p0.raw)
|
|
expect(json[:target_url]).to eq(Discourse.base_url + p0.url)
|
|
end
|
|
|
|
it "works when the topic is deleted" do
|
|
reviewable = Fabricate(:reviewable_queued_post)
|
|
reviewable.topic.update(deleted_at: Time.now)
|
|
reviewable.reload
|
|
|
|
json = ReviewableQueuedPostSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_json
|
|
expect(json[:id]).to be_present
|
|
end
|
|
|
|
end
|