Sha256: 32d09b35b48d98dd4be725ec06b2de0df1c6fd589cb6c76796c936a07fa8b406

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

=begin

The idea here is that unit tests should reflect
the model of the class and method it is testing.
To do this we want to achieve a kind of AOP-like
system to monitor the original. So for instance,
given:

  class Hash

    # Push a pair onto the
    #
    #
    def #<<(pair)
      self.store(*pair)
    end

  end

We could construct:

  require 'quarry/unitspec'

  module Quarry::UnitSpecs

    class Hash << ::Hash

      def #<<(pair)
        r = super
        self[pair[0]].assert == pair[1]
        r
      end

    end

    h = Hash.new
    h << [:a, 1]

  end

To make this more convenient.

  Quarry.unitspec(Hash) do

    unit(:<<) do |pair|
      r = super
      self[pair[0]].assert == pair[1]
      r
    end

  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quarry-0.4.0 work/sandbox/unitspec.rb