Sha256: 2997cdaa357f5e3342d8fa87b4e7eecc945354ef025a30f4e55cefe476a6cee0

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

module QED

  require 'qed/expectation'

  module Grammar

    # = Should Nomenclature
    #
    # The term *should* has become the defacto standard for
    # BDD assertions, so Quarry supports this nomenclature.
    #
    module Should

      # Same as #expect but only as a functor.
      #
      #   4.should == 3  #=> Expectation Error
      #
      def should
        return Expectation.new(self, :backtrace=>caller)
      end

      # Designate a negated expectation via a *functor*.
      # Read this as "should not".
      #
      #   4.should! == 4  #=> Expectation Error
      #
      # See also #expect!
      #
      def should!
        return Expectation.new(self, :negate=>true, :backtrace=>caller)
      end

      # See #should! method.
      #
      alias_method :should_not, :should!

      #
      #alias_method :should_raise, :assert_raises

      #
      #alias_method :should_not_raise, :assert_raises!

    end

  end

  class ::Object #:nodoc:
    include Grammar::Should
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qed-1.0.0 lib/qed/grammar/should.rb