added the files and fixed the tests
This commit is contained in:
parent
249b62445f
commit
a92a374b96
3 changed files with 10 additions and 34 deletions
|
|
@ -87,7 +87,7 @@ describe Notifier do
|
||||||
let!(:comment) { user2.comment("Totally is", :on => sm )}
|
let!(:comment) { user2.comment("Totally is", :on => sm )}
|
||||||
describe "#comment_on_post" do
|
describe "#comment_on_post" do
|
||||||
|
|
||||||
let!(:comment_mail) {Notifier.comment_on_post(user.id, person.id, comment).deliver}
|
let!(:comment_mail) {Notifier.comment_on_post(user.id, person.id, comment.id).deliver}
|
||||||
|
|
||||||
it 'goes to the right person' do
|
it 'goes to the right person' do
|
||||||
comment_mail.to.should == [user.email]
|
comment_mail.to.should == [user.email]
|
||||||
|
|
@ -108,7 +108,7 @@ describe Notifier do
|
||||||
end
|
end
|
||||||
describe "#also commented" do
|
describe "#also commented" do
|
||||||
|
|
||||||
let!(:comment_mail) {Notifier.also_commented(user.id, person.id, comment)}
|
let!(:comment_mail) {Notifier.also_commented(user.id, person.id, comment.id)}
|
||||||
|
|
||||||
it 'goes to the right person' do
|
it 'goes to the right person' do
|
||||||
comment_mail.to.should == [user.email]
|
comment_mail.to.should == [user.email]
|
||||||
|
|
|
||||||
|
|
@ -68,34 +68,18 @@ describe Notification do
|
||||||
Notification.notify(@user, request, @person)
|
Notification.notify(@user, request, @person)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'emails the user' do
|
describe '#emails_the_user' do
|
||||||
it 'email with notifications enabled' do
|
it 'calls mail' do
|
||||||
request = Request.instantiate(:from => @user.person, :to => @user2.person, :into => @aspect)
|
opts = {
|
||||||
opts = {:target_id => request.id,
|
:kind => "new_request",
|
||||||
:kind => request.notification_type(@user, @person),
|
|
||||||
:person_id => @person.id,
|
:person_id => @person.id,
|
||||||
:user_id => @user.id}
|
:user_id => @user.id}
|
||||||
|
|
||||||
n = Notification.create(opts)
|
n = Notification.new(opts)
|
||||||
Notification.stub!(:create).and_return n
|
n.stub!(:user).and_return @user
|
||||||
|
|
||||||
n.should_receive(:email_the_user).once
|
@user.should_receive(:mail)
|
||||||
Notification.notify(@user, request, @person)
|
n.email_the_user("mock")
|
||||||
end
|
|
||||||
|
|
||||||
it 'does not email with emails disabled' do
|
|
||||||
request = Request.instantiate(:from => @user.person, :to => @user2.person, :into => @aspect)
|
|
||||||
opts = {:target_id => request.id,
|
|
||||||
:kind => request.notification_type(@user, @person),
|
|
||||||
:person_id => @person.id,
|
|
||||||
:user_id => @user.id}
|
|
||||||
|
|
||||||
n = Notification.create(opts)
|
|
||||||
Notification.stub!(:create).and_return n
|
|
||||||
|
|
||||||
@user.disable_mail = true
|
|
||||||
n.should_not_receive(:email_the_user)
|
|
||||||
Notification.notify(@user, request, @person)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -60,14 +60,6 @@ describe Diaspora::UserModules::Connecting do
|
||||||
Resque.should_receive(:enqueue).with(Jobs::MailRequestReceived, user.id, person.id)
|
Resque.should_receive(:enqueue).with(Jobs::MailRequestReceived, user.id, person.id)
|
||||||
user.receive_object(@r, person)
|
user.receive_object(@r, person)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not lock the connection after ignore' do
|
|
||||||
user.send_friend_request_to(user2, aspect)
|
|
||||||
user2.pending_request.count.should == 1
|
|
||||||
user2.ignore_request(user2.pending_requests.first)
|
|
||||||
user.send_friend_request_to(user2, aspect)
|
|
||||||
user2.pending_request.count.should == 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#receive_request_acceptance' do
|
describe '#receive_request_acceptance' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue