prefabrication of users in flag_query_spec.rb
This commit is contained in:
parent
20daa76829
commit
cbcfc89fac
|
@ -4,16 +4,14 @@ require 'rails_helper'
|
||||||
require_dependency 'flag_query'
|
require_dependency 'flag_query'
|
||||||
|
|
||||||
describe FlagQuery do
|
describe FlagQuery do
|
||||||
|
fab!(:admin) { Fabricate(:admin) }
|
||||||
|
fab!(:moderator) { Fabricate(:moderator) }
|
||||||
fab!(:codinghorror) { Fabricate(:coding_horror) }
|
fab!(:codinghorror) { Fabricate(:coding_horror) }
|
||||||
|
|
||||||
describe "flagged_topics" do
|
describe "flagged_topics" do
|
||||||
it "respects `reviewable_default_visibility`" do
|
it "respects `reviewable_default_visibility`" do
|
||||||
Reviewable.set_priorities(medium: 10.0)
|
Reviewable.set_priorities(medium: 10.0)
|
||||||
|
|
||||||
admin = Fabricate(:admin)
|
|
||||||
moderator = Fabricate(:moderator)
|
|
||||||
|
|
||||||
post = create_post
|
post = create_post
|
||||||
|
|
||||||
SiteSetting.reviewable_default_visibility = 'low'
|
SiteSetting.reviewable_default_visibility = 'low'
|
||||||
|
@ -45,7 +43,6 @@ describe FlagQuery do
|
||||||
describe "flagged_post_actions" do
|
describe "flagged_post_actions" do
|
||||||
|
|
||||||
it "returns the proper count" do
|
it "returns the proper count" do
|
||||||
moderator = Fabricate(:moderator)
|
|
||||||
post = create_post
|
post = create_post
|
||||||
PostActionCreator.spam(moderator, post)
|
PostActionCreator.spam(moderator, post)
|
||||||
expect(FlagQuery.flagged_post_actions(topic_id: post.topic_id).count).to eq(1)
|
expect(FlagQuery.flagged_post_actions(topic_id: post.topic_id).count).to eq(1)
|
||||||
|
@ -55,7 +52,6 @@ describe FlagQuery do
|
||||||
|
|
||||||
describe "flagged_posts_report" do
|
describe "flagged_posts_report" do
|
||||||
it "does not return flags on system posts" do
|
it "does not return flags on system posts" do
|
||||||
admin = Fabricate(:admin)
|
|
||||||
post = create_post(user: Discourse.system_user)
|
post = create_post(user: Discourse.system_user)
|
||||||
PostActionCreator.create(codinghorror, post, :spam)
|
PostActionCreator.create(codinghorror, post, :spam)
|
||||||
posts, topics, users = FlagQuery.flagged_posts_report(admin)
|
posts, topics, users = FlagQuery.flagged_posts_report(admin)
|
||||||
|
@ -66,9 +62,6 @@ describe FlagQuery do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "operates correctly" do
|
it "operates correctly" do
|
||||||
admin = Fabricate(:admin)
|
|
||||||
moderator = Fabricate(:moderator)
|
|
||||||
|
|
||||||
post = create_post
|
post = create_post
|
||||||
post2 = create_post
|
post2 = create_post
|
||||||
|
|
||||||
|
@ -136,7 +129,6 @@ describe FlagQuery do
|
||||||
Reviewable.set_priorities(medium: 3.0)
|
Reviewable.set_priorities(medium: 3.0)
|
||||||
SiteSetting.reviewable_default_visibility = 'medium'
|
SiteSetting.reviewable_default_visibility = 'medium'
|
||||||
|
|
||||||
admin = Fabricate(:admin)
|
|
||||||
flagger = Fabricate(:user)
|
flagger = Fabricate(:user)
|
||||||
|
|
||||||
post = create_post
|
post = create_post
|
||||||
|
|
Loading…
Reference in New Issue