Sha256: b55d496da9f8cbd4f7f685b61cd2eacf78c96f6764f3aa240538fb5cb1f2e68e

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require "#{::File.dirname(__FILE__)}/../../test_helper"

module PoolParty
  module Verifiers
    class Ping < VerifierBase
      attr_accessor :port, :checked
      def initialize(port=80)
        @port = port
      end
      def passing?
        @checked
      end
    end
    
  end
end
class TestVerificationClass
  include PoolParty::Verification
  
  attr_reader :port
  def initialize(port=70, &block)
    @port = port
    instance_eval &block
  end    
end

class TestVerification < Test::Unit::TestCase
  context "verification included" do
    setup do
      @vc = TestVerificationClass.new do
        verify do
          ping 80
        end
      end
    end
    should "have a the ping verifier as a verifiers in the class" do
      @vc.verifiers.first.class.should == PoolParty::Verifiers::Ping
    end
    should "not explode when calling verify on the verifier" do
      @vc.verifiers.first.checked = true
      @vc.passing?.should == true
    end
    should "explode if the verification fails" do
      @vc.verifiers.first.checked = false
      lambda {@vc.passing?}.should raise_error
    end
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
auser-poolparty-1.1.6 test/poolparty/verification/verify_test.rb
auser-poolparty-1.1.7 test/poolparty/verification/verify_test.rb
fairchild-poolparty-1.1.5 test/poolparty/verification/verify_test.rb