diaspora/spec/mailers/report_spec.rb
Lukas Matt 01a45ccf40 Reports email notification; wrong recipient
The mailer uses the person_id to find a user
which cannot work on a production environment.

I haven't used a remote user on my test setup.
2014-06-23 15:54:25 -04:00

32 lines
963 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 Report do
describe '#make_notification' do
before do
@remote = FactoryGirl.create(:person, :diaspora_handle => "remote@remote.net")
@user = FactoryGirl.create(:user_with_aspect, :username => "local")
Role.add_admin(@user.person)
end
it "should deliver successfully" do
expect {
ReportMailer.new_report('post', 666)
}.to_not raise_error
end
it "should be added to the delivery queue" do
expect {
ReportMailer.new_report('post', 666)
}.to change(ActionMailer::Base.deliveries, :size).by(1)
end
it "should include correct recipient" do
ReportMailer.new_report('post', 666)
expect(ActionMailer::Base.deliveries[0].to[0]).to include(@user.email)
end
end
end