Merge pull request #1569 from balexand/fix_1567
Fix #1567; nil reference in spam_rules_enforcer.rb
This commit is contained in:
commit
d069481235
|
@ -76,7 +76,7 @@ class PostCreator
|
||||||
{ user: @user,
|
{ user: @user,
|
||||||
limit_once_per: 24.hours,
|
limit_once_per: 24.hours,
|
||||||
message_params: {domains: @post.linked_hosts.keys.join(', ')} } )
|
message_params: {domains: @post.linked_hosts.keys.join(', ')} } )
|
||||||
else
|
elsif @post && !@post.errors.present?
|
||||||
SpamRulesEnforcer.enforce!(@post)
|
SpamRulesEnforcer.enforce!(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,17 @@ describe PostCreator do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "invalid raw" do
|
||||||
|
|
||||||
|
let(:creator_invalid_raw) { PostCreator.new(user, basic_topic_params.merge(raw: '')) }
|
||||||
|
|
||||||
|
it "has errors" do
|
||||||
|
creator_invalid_raw.create
|
||||||
|
expect(creator_invalid_raw.errors).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
context "success" do
|
context "success" do
|
||||||
|
|
||||||
it "doesn't return true for spam" do
|
it "doesn't return true for spam" do
|
||||||
|
|
Loading…
Reference in New Issue