Sha256: 37623abc4d39b67f48cc34ec1f6efdf25c0d4b26b11b264f191d4d66cc5a3d75

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'test_helper'

require 'outpost/scouts/http'

describe "basic application integration test" do
  before(:each) do
    @server = Server.new
    @server.boot(TestApp)

    while !@server.responsive?
      sleep 0.1
    end
  end

  class ExampleSuccess < Outpost::Application
    using Outpost::Scouts::Http => 'master http server' do
      options :host => 'localhost', :port => 9595
      report :up, :response_code => 200
    end
  end

  class ExampleFailure < Outpost::Application
    using Outpost::Scouts::Http => 'master http server' do
      options :host => 'localhost', :port => 9595, :path => '/fail'
      report :up, :response_code => 200
    end
  end

  class ExampleBodyFailure < Outpost::Application
    using Outpost::Scouts::Http => 'master http server' do
      options :host => 'localhost', :port => 9595, :path => '/fail'
      report :down, :response_body => {:equals => 'Omg fail'}
    end
  end

  class ExampleBodySuccess < Outpost::Application
    using Outpost::Scouts::Http => 'master http server' do
      options :host => 'localhost', :port => 9595, :path => '/'
      report :up, :response_body => {:match => /Up/}
    end
  end

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

  it "should report failure when something's wrong" do
    assert_equal :down, ExampleFailure.new.run
  end

  it "should report success when body is okay" do
    assert_equal :up, ExampleBodySuccess.new.run
  end

  it "should report failure when body is wrong" do
    assert_equal :down, ExampleBodyFailure.new.run
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outpost-0.2.0 test/integration/basic_application_test.rb