Sha256: b4d19d16f7e6ccc7aaea1c5f0a4ccf9d5d4c50a4d894a17dde14ee4e2a6d01de

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# Namespace for the Fix framework.
module Fix
  # Override Fix's On class.
  class On
    # Useful to perform side-effects, e.g., add something in to a database.
    #
    # @note To declare an instance variable, use the `let` helper instead.
    #
    # @param block [Proc] The block to call.
    #
    # @return [#object_id] The given block.
    def before(*, &block)
      block.call
    end

    # @param another_front_object [#object_id]  Override the front object.
    # @param specs                [Proc]        A set of specs.
    #
    # @return [Array] List of results.
    def describe(another_front_object, *, &specs)
      o = On.new(another_front_object,
                 results,
                 challenges,
                 helpers.dup,
                 configuration)

      o.instance_eval(&specs)
    end

    # Override the implicit subject.
    #
    # @param block [Proc, nil] Another subject inside a block.
    #
    # @return [#object_id] The subject.
    def subject(&block)
      if block_given?
        @described = block.call
      else
        super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r_spec-0.3.0 lib/fix/on.rb
r_spec-0.2.0 lib/fix/on.rb