mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-20 20:42:44 -05:00
f0a122a66c
introduce new setting email_always, that will force emails to send to users regardless of presence on site
25 lines
762 B
Ruby
25 lines
762 B
Ruby
require 'spec_helper'
|
|
require 'jobs/regular/send_system_message'
|
|
|
|
describe Jobs::SendSystemMessage do
|
|
|
|
it "raises an error without a user_id" do
|
|
lambda { Jobs::SendSystemMessage.new.execute(message_type: 'welcome_invite') }.should raise_error(Discourse::InvalidParameters)
|
|
end
|
|
|
|
it "raises an error without a message_type" do
|
|
lambda { Jobs::SendSystemMessage.new.execute(user_id: 1234) }.should raise_error(Discourse::InvalidParameters)
|
|
end
|
|
|
|
context 'with valid parameters' do
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
it "should call SystemMessage.create" do
|
|
SystemMessage.any_instance.expects(:create).with('welcome_invite')
|
|
Jobs::SendSystemMessage.new.execute(user_id: user.id, message_type: 'welcome_invite')
|
|
end
|
|
|
|
end
|
|
|
|
end
|