mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
Initial release of Discourse
This commit is contained in:
60
spec/mailers/user_notifications_spec.rb
Normal file
60
spec/mailers/user_notifications_spec.rb
Normal file
@ -0,0 +1,60 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe UserNotifications do
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
describe ".signup" do
|
||||
subject { UserNotifications.signup(user) }
|
||||
|
||||
its(:to) { should == [user.email] }
|
||||
its(:subject) { should be_present }
|
||||
its(:from) { should == [SiteSetting.notification_email] }
|
||||
its(:body) { should be_present }
|
||||
end
|
||||
|
||||
describe ".forgot_password" do
|
||||
subject { UserNotifications.forgot_password(user) }
|
||||
|
||||
its(:to) { should == [user.email] }
|
||||
its(:subject) { should be_present }
|
||||
its(:from) { should == [SiteSetting.notification_email] }
|
||||
its(:body) { should be_present }
|
||||
end
|
||||
|
||||
describe '.daily_digest' do
|
||||
subject { UserNotifications.digest(user) }
|
||||
|
||||
context "without new topics" do
|
||||
its(:to) { should be_blank }
|
||||
end
|
||||
|
||||
context "with new topics" do
|
||||
before do
|
||||
Topic.expects(:new_topics).returns([Fabricate(:topic, user: Fabricate(:coding_horror))])
|
||||
end
|
||||
|
||||
its(:to) { should == [user.email] }
|
||||
its(:subject) { should be_present }
|
||||
its(:from) { should == [SiteSetting.notification_email] }
|
||||
its(:body) { should be_present }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.user_mentioned' do
|
||||
|
||||
let(:post) { Fabricate(:post, user: user) }
|
||||
let(:notification) do
|
||||
Fabricate(:notification, user: user, topic: post.topic, post_number: post.post_number )
|
||||
end
|
||||
|
||||
subject { UserNotifications.user_mentioned(user, notification: notification, post: notification.post) }
|
||||
|
||||
its(:to) { should == [user.email] }
|
||||
its(:subject) { should be_present }
|
||||
its(:from) { should == [SiteSetting.notification_email] }
|
||||
its(:body) { should be_present }
|
||||
end
|
||||
|
||||
|
||||
end
|
Reference in New Issue
Block a user