Sha256: f002b6d0be34d0ccb9f929c88a42fdcde4c9166e6a7bf660d4d58156e4ff838e

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

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

describe "creating outpost apps without subclassing" do
  before(:each) do
    @server = Server.new
    @server.boot(TestApp)
    @server.wait_until_booted

    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

4 entries across 4 versions & 1 rubygems

Version Path
outpost-0.2.4 test/integration/no_subclassing_test.rb
outpost-0.2.3 test/integration/no_subclassing_test.rb
outpost-0.2.2 test/integration/no_subclassing_test.rb
outpost-0.2.1 test/integration/no_subclassing_test.rb