Sha256: 0cac9e24f682f5dafdf67219109bd5bb9ec1707620266aa9a5d3c067e9678e3f

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Rearview::AlertMailer do

  let(:result) { {:message => "failure oops bad"} }
  let(:job) { create(:job) }
  let(:mail) { Rearview::AlertMailer.alert_email("foo@foo.com",job,result) }

  context 'subject' do
    it 'contains the job name' do
      expect(mail.subject).to match(/#{job.name}/)
    end
    it 'contains subject tag' do
      expect(mail.subject).to match(/\[Rearview ALERT\]/)
    end
  end

  context 'body' do
    it 'has the alert message' do
      expect(mail.body.encoded).to match(/ALERT: #{result[:message]}/)
    end
    it 'has the monitor name' do
      expect(mail.body.encoded).to match(/Monitor: #{job.name}/)
    end
    it 'has the monitor description' do
      expect(mail.body.encoded).to match(/Description: #{job.description}/)
    end
    it 'has the alerted on date' do
      expect(mail.body.encoded).to match(/Alerted On: .*/)
    end
    it 'has a direct link' do
      expect(mail.body.encoded).to match(%r{Direct Link: http://localhost:3000/rearview/#dash/#{job.app_id}/expand/#{job.id}})
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.2.2.rc.2-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.2.2.rc.1-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.2.1-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.2.0-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.1.2-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.1.1-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.1.0-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.3.rc.4-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.3.rc.3-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.3.rc.2-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.3.rc.1-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.2-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.2.rc.4-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.2.rc.3-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.2.rc.2-jruby spec/mailers/alert_mailer_spec.rb
rearview-1.0.2.rc.1-jruby spec/mailers/alert_mailer_spec.rb