diaspora/spec/workers/mail/private_message_spec.rb
Jonne Haß 79a79d65d6 Bye Resque. Ohai Sidekiq.
* Dropped all references to Resque
* Moved all jobs under app/workers since that's the Sidekiq convention
* Renamed Jobs module to Worker to match new location
* Adapted all jobs to Sidekiq
* Replaced all enqueue calls with perform_async
* Dropped Resque hacks from specs and features, replaced with
  sidekig/testing in RSpec and sidekig/testing/inline in Cucumber
* Updated scripts to start a Sidekiq server
* Inline Sidekiq sinatra app
* Let Sidekiq create the actual Redis instance
* Workaround already initialized constant warnings in service models
* Resolved ToDo in one job definition by creating proper exception clases
  for some errors in receiving posts
* Added sidekiq section to configuration to make it completly
  configurable to the user
* Add Sidekiq middleware for clean backtraces
* Delay HttpMulti retry to give offline pods a chance to come back up
* Do not retry on GUID already taken and alike errors
* Be graceful about deleted posts in GatherOEmbedData
2013-03-21 23:39:07 +01:00

27 lines
962 B
Ruby

# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe Workers::Mail::PrivateMessage do
describe '#perfom_delegate' do
it 'should call .deliver on the notifier object' do
user1 = alice
user2 = bob
participant_ids = [user1.contacts.first.person.id, user1.person.id]
create_hash = { :author => user1.person, :participant_ids => participant_ids ,
:subject => "cool stuff", :messages_attributes => [{:text => 'hey'}]}
cnv = Conversation.create(create_hash)
message = cnv.messages.first
mail_mock = mock()
mail_mock.should_receive(:deliver)
Notifier.should_receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_mock)
Workers::Mail::Mentioned.new.perform(user2.id, user1.person.id, message.id)
end
end
end