added the files and fixed the tests

This commit is contained in:
zhitomirskiyi 2011-01-06 17:14:39 -08:00
parent 249b62445f
commit a92a374b96
3 changed files with 10 additions and 34 deletions

View file

@ -87,7 +87,7 @@ describe Notifier do
let!(:comment) { user2.comment("Totally is", :on => sm )}
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
comment_mail.to.should == [user.email]
@ -108,7 +108,7 @@ describe Notifier do
end
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
comment_mail.to.should == [user.email]

View file

@ -68,34 +68,18 @@ describe Notification do
Notification.notify(@user, request, @person)
end
context 'emails the user' do
it 'email with notifications enabled' do
request = Request.instantiate(:from => @user.person, :to => @user2.person, :into => @aspect)
opts = {:target_id => request.id,
:kind => request.notification_type(@user, @person),
describe '#emails_the_user' do
it 'calls mail' do
opts = {
:kind => "new_request",
:person_id => @person.id,
:user_id => @user.id}
n = Notification.create(opts)
Notification.stub!(:create).and_return n
n = Notification.new(opts)
n.stub!(:user).and_return @user
n.should_receive(:email_the_user).once
Notification.notify(@user, request, @person)
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)
@user.should_receive(:mail)
n.email_the_user("mock")
end
end
end

View file

@ -60,14 +60,6 @@ describe Diaspora::UserModules::Connecting do
Resque.should_receive(:enqueue).with(Jobs::MailRequestReceived, user.id, person.id)
user.receive_object(@r, person)
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
describe '#receive_request_acceptance' do