Sha256: 58e0df84f948167bf3d91008e2dd851afc315e0184d14935907b8cdbdad90d83

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

require 'outpost/scouts/http'
require 'outpost/notifiers/email'

describe "creating outpost apps without subclassing" do
  before do
    Mail.defaults do
      delivery_method :test
    end
  end

  after(:each) do
    Mail::TestMailer.deliveries = []
  end

  it "should report up when everything's ok" do
    assert_equal :up, outpost.run
  end

  it "should notify up when everything's ok" do
    outpost.add_notifier Outpost::Notifiers::Email, {
      :from    => 'outpost@example.com',
      :to      => 'sleep_deprived_admin@example.com',
      :subject => 'System 1 status'
    }

    outpost.run
    outpost.notify

    refute_empty Mail::TestMailer.deliveries
  end

  it "should not notify when there are no notifiers" do
    outpost.run

    assert_empty Mail::TestMailer.deliveries
  end

  private

  def outpost
    @outpost ||= Outpost::Application.new.tap do |outpost|
      outpost.add_scout Outpost::Scouts::Http => 'master http server' do
        options :host => 'localhost', :port => 9595
        report :up, :response_code => 200
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outpost-0.2.5 test/integration/no_subclassing_test.rb