aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mailers/info_request_batch_mailer_spec.rb
blob: 19791e163a4023df09bb8db388c358acd3bbd7eb (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
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe InfoRequestBatchMailer do

  describe 'when sending batch sent notification' do

        before do
            @user = FactoryGirl.create(:user)
            @info_request_batch = FactoryGirl.create(:info_request_batch)
            @public_body = FactoryGirl.create(:public_body)
            @unrequestable = [@public_body]
            @mail = InfoRequestBatchMailer.batch_sent(@info_request_batch, @unrequestable, @user)
        end

    it 'renders the subject' do
      @mail.subject.should == 'Your batch request "Example title" has been sent'
    end

    it 'renders the receiver email' do
      @mail.to.should == [@user.email]
    end

    it 'renders the sender email' do
      @mail.from.should == ['postmaster@localhost']
    end

    it 'assigns @unrequestable' do
      @mail.body.encoded.should match(@public_body.name)
    end

    it 'assigns @url' do
      @mail.body.encoded.should match("http://test.host/en/c/")
    end
  end
end