Sha256: 3beff3c8c3199cadcdb8962b0b1d6f39d6a8acdf900f56c74b7df8217363675c

Contents?: true

Size: 539 Bytes

Versions: 3

Compression:

Stored size: 539 Bytes

Contents

require 'nagios_check'

module Matchers
  class Contain
    def initialize(expected)
      @expected = expected
    end

    def matches?(actual)
      @actual = actual
      !@actual.include?(@expected)
    end

    def failure_message
      "expected #{@actual} to alert for value #{@expected}" 
    end

    def negative_failure_message
      "expected #{@actual} not to alert for value #{@expected}"
    end
  end

  def alert_if(value)
    Contain::new(value)
  end
end

RSpec.configure do |config|  
  config.include(Matchers)  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios_check-0.4.0 spec/spec_helper.rb
nagios_check-0.3.1 spec/spec_helper.rb
nagios_check-0.3.0 spec/spec_helper.rb