Sha256: 8e2eced611dde3210c0e62f4cee2b8df72b4072187b6282dd7679bd87fc953cb

Contents?: true

Size: 730 Bytes

Versions: 3

Compression:

Stored size: 730 Bytes

Contents

module Outpost
  module Expectations
    # Module containing response_code logic. It is the simplest of all,
    # it is a simple direct equality check. Extend your Scout to win instant
    # response_code checking.
    module ResponseCode
      # Installs the response code expectation
      def self.extended(base)
        base.expect :response_code, base.method(:evaluate_response_code)
      end

      # Method that will be used as an expectation to evaluate response code
      def evaluate_response_code(scout, response_code)
        if response_code.is_a?(Array)
          response_code.include?(scout.response_code)
        else
          scout.response_code == response_code.to_i
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
outpost-0.2.3 lib/outpost/expectations/response_code.rb
outpost-0.2.2 lib/outpost/expectations/response_code.rb
outpost-0.2.1 lib/outpost/expectations/response_code.rb