Welcome to mirror list, hosted at ThFree Co, Russian Federation.

notifier_spec.rb « mailers « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 88550680fc67ed0705e72040c8ec7101828f8d85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

require 'spec_helper'

describe Notifier do

  let!(:user) {Factory.create :user}
  let!(:aspect) {user.aspect(:name => "science")}
  let!(:person) {Factory.create :person}
  let!(:request_mail) {Notifier.new_request(user, person)}
  let!(:request_accepted_mail) {Notifier.request_accepted(user, person, aspect)}


  describe "#new_request" do
    it 'goes to the right person' do
      request_mail.to.should == [user.email]
    end

    it 'has the receivers name in the body' do
      request_mail.body.encoded.include?(user.person.profile.first_name).should be true
    end


    it 'has the name of person sending the request' do
      request_mail.body.encoded.include?(person.real_name).should be true
    end
  end

  describe "#request_accpeted" do
    it 'goes to the right person' do
      request_accepted_mail.to.should == [user.email]
    end

    it 'has the receivers name in the body' do
      request_accepted_mail.body.encoded.include?(user.person.profile.first_name).should be true
    end


    it 'has the name of person sending the request' do
      request_accepted_mail.body.encoded.include?(person.real_name).should be true
    end

    it 'has the name of the aspect in the body' do
      request_accepted_mail.body.encoded.include?(aspect.name).should be true
    end
  end
end