mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 06:15:48 +08:00
b3d769ff4f
update rspec syntax to v3 change syntax to rspec v3 oops. fix typo mailers classes with rspec3 syntax helpers with rspec3 syntax jobs with rspec3 syntax serializers with rspec3 syntax views with rspec3 syntax support to rspec3 syntax category spec with rspec3 syntax
26 lines
754 B
Ruby
26 lines
754 B
Ruby
require 'spec_helper'
|
|
require 'jobs/regular/send_system_message'
|
|
|
|
describe Jobs::SendSystemMessage do
|
|
|
|
it "raises an error without a user_id" do
|
|
expect { Jobs::SendSystemMessage.new.execute(message_type: 'welcome_invite') }.to raise_error(Discourse::InvalidParameters)
|
|
end
|
|
|
|
it "raises an error without a message_type" do
|
|
expect { Jobs::SendSystemMessage.new.execute(user_id: 1234) }.to 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
|