Sha256: 420e2ceb7d8a06af79b94219993ba6dea378ff2147ac98cc04a285e786a7bed3

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

require 'fix'

# Namespace for the Fix framework.
#
# @api public
#
module Fix
  # Its's helper.
  #
  # @api private
  #
  module Its
    # Add its method to the DSL.
    #
    # @api public
    #
    # @example Its absolute value must equal 42
    #   its(:abs) { MUST Equal: 42 }
    #
    # @param method_name [Symbol] The identifier of a method.
    # @param spec        [Proc]   A spec to compare against the computed value.
    #
    # @return [Array] List of results.
    def its(method_name, &spec)
      i = It.new do
        Sandbox.new(@front_object,
                    *@challenges, Spectus::Challenge.new(method_name)).actual
      end

      result = begin
                 i.instance_eval(&spec)
               rescue Spectus::Result::Fail => f
                 f
               end

      print result.to_char
      results << result
    end
  end

  # Include the content of the Its module in to On class.
  #
  # @api private
  #
  class On
    include Its
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fix-its-0.1.1 lib/fix/its.rb
fix-its-0.1.0 lib/fix/its.rb