port notify local users worker spec to doubles
This commit is contained in:
parent
7c28921ec7
commit
79e1a9aafd
1 changed files with 6 additions and 7 deletions
|
|
@ -7,14 +7,13 @@ require 'spec_helper'
|
|||
describe Workers::NotifyLocalUsers do
|
||||
describe '#perfom' do
|
||||
it 'should call Notification.notify for each participant user' do
|
||||
person = FactoryGirl.create :person
|
||||
post = FactoryGirl.create :status_message
|
||||
post = double(id: 1234, author: double(diaspora_handle: "foo@bar"))
|
||||
klass_name = double(constantize: double(find_by_id: post))
|
||||
person = double(id: 4321)
|
||||
allow(Person).to receive(:find_by_id).and_return(person)
|
||||
expect(Notification).to receive(:notify).with(instance_of(User), post, person).twice
|
||||
|
||||
expect(StatusMessage).to receive(:find_by_id).with(post.id).and_return(post)
|
||||
#User.should_receive(:where).and_return([alice, eve])
|
||||
expect(Notification).to receive(:notify).with(instance_of(User), instance_of(StatusMessage), instance_of(Person)).twice
|
||||
|
||||
Workers::NotifyLocalUsers.new.perform([alice.id, eve.id], post.class.to_s, post.id, person.id)
|
||||
Workers::NotifyLocalUsers.new.perform([alice.id, eve.id], klass_name, post.id, person.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue