mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: Don't raise an error when trying to log nothing
This commit is contained in:
parent
748c13f4a7
commit
b2e2a99898
2 changed files with 16 additions and 0 deletions
|
@ -144,6 +144,8 @@ class StaffActionLogger
|
|||
end
|
||||
|
||||
def log_show_emails(users)
|
||||
return if users.blank?
|
||||
|
||||
values = []
|
||||
|
||||
users.each do |user|
|
||||
|
|
|
@ -33,6 +33,20 @@ describe StaffActionLogger do
|
|||
end
|
||||
end
|
||||
|
||||
describe "log_show_emails" do
|
||||
it "logs the user history" do
|
||||
-> { logger.log_show_emails([admin]) }.should change(UserHistory, :count).by(1)
|
||||
end
|
||||
|
||||
it "doesn't raise an exception with nothing to log" do
|
||||
-> { logger.log_show_emails([]) }.should_not raise_error
|
||||
end
|
||||
|
||||
it "doesn't raise an exception with nil input" do
|
||||
-> { logger.log_show_emails(nil) }.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
describe 'log_post_deletion' do
|
||||
let(:deleted_post) { Fabricate(:post) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue