summaryrefslogtreecommitdiff
path: root/spec/mailers/notify_spec.rb
blob: efb202f39f0f6955fc826cd4270c7f688a4b87f8 (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
require 'spec_helper'

describe Notify do
  include EmailSpec::Helpers
  include EmailSpec::Matchers

  before do
    @project = FactoryGirl.create :project
    @commit = FactoryGirl.create :commit, project: @project
    @build = FactoryGirl.create :build, commit: @commit
  end

  describe 'build success' do
    subject { described_class.build_success_email(@build.id, 'wow@example.com') }

    it 'has the correct subject' do
      is_expected.to have_subject /Build success for/
    end

    it 'contains name of project' do
      is_expected.to have_body_text /build successful/
    end
  end

  describe 'build fail' do
    subject { described_class.build_fail_email(@build.id, 'wow@example.com') }

    it 'has the correct subject' do
      is_expected.to have_subject /Build failed for/
    end

    it 'contains name of project' do
      is_expected.to have_body_text /build failed/
    end
  end
end