Sha256: 9d70edcc2ed21dae9bea2136245f210b0782bc296af50515703e325cb720029a

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module Fix
  # On's helper.
  #
  # @api private
  #
  module OnHelper
    # Add on method to the DSL.
    #
    # @api public
    #
    # @example On +2, it must equal 44.
    #   on(:+, 2) do
    #     it { MUST Equal: 44 }
    #   end
    #
    # @param method_name [Symbol] The identifier of a method.
    # @param args        [Array]  A list of arguments.
    # @param block       [Proc]   A spec to compare against the computed value.
    #
    # @return [Array] List of results.
    def on(method_name, *args, &block)
      o = On.new(@front_object,
                 results,
                 (@challenges + [Spectus::Challenge.new(method_name, *args)]),
                 @configuration)

      o.instance_eval(&block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fix-0.9.0 lib/fix/helpers/on_helper.rb
fix-0.8.0 lib/fix/helpers/on_helper.rb