Sha256: c287ac57558fac0c308c9dfb8bef88aa9483616b121e6e4fc5957e88cfe01e0f

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

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

module PoolParty
  module Verifiers
    class Ding < 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
          ding 830
        end
      end
    end
    should "have a the ping verifier as a verifiers in the class" do
      @vc.verifiers.first.class.should == PoolParty::Verifiers::Ding
    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

8 entries across 8 versions & 2 rubygems

Version Path
auser-poolparty-1.2.0 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.1 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.2 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.3 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.4 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.7 test/poolparty/verification/verify_test.rb
auser-poolparty-1.2.8 test/poolparty/verification/verify_test.rb
poolparty-1.2.2 test/poolparty/verification/verify_test.rb