Sha256: c84a3337ec8926bfa9a66e60bf2dddaae31448fbd316c66493f4556cdaa4242b

Contents?: true

Size: 1.16 KB

Versions: 28

Compression:

Stored size: 1.16 KB

Contents

module RR
  module DoubleDefinitions
    module Strategies
      module Verification
        # This method sets the Double to have a dont_allow strategy.
        # A dont_allow strategy sets the default state of the Double
        # to expect never to be called. The Double's expectations can be
        # changed.
        #
        # The following example sets the expectation that subject.method_name
        # will never be called with arg1 and arg2.
        #
        #   do_not_allow(subject).method_name(arg1, arg2)
        #
        # dont_allow also supports a block sytnax.
        #    dont_allow(subject) do |m|
        #      m.method1 # Do not allow method1 with any arguments
        #      m.method2(arg1, arg2) # Do not allow method2 with arguments arg1 and arg2
        #      m.method3.with_no_args # Do not allow method3 with no arguments
        #    end        
        class DontAllow < VerificationStrategy
          register("dont_allow", :do_not_allow, :dont_call, :do_not_call)

          protected
          def do_call
            definition.never
            permissive_argument
            reimplementation
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 5 rubygems

Version Path
adva-0.3.2 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.3.1 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.3.0 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.2.4 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.2.3 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.2.2 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.2.1 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.2.0 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.1.4 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.1.3 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.1.2 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.1.1 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.1.0 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
adva-0.0.1 test/rr/lib/rr/double_definitions/strategies/verification/dont_allow.rb
jferris-rr-0.7.1.0.1239654108 lib/rr/double_definitions/strategies/verification/dont_allow.rb
redinger-redinger-rr-0.10.3 lib/rr/double_definitions/strategies/verification/dont_allow.rb
redinger-rr-0.10.4 lib/rr/double_definitions/strategies/verification/dont_allow.rb
rr-0.10.5 lib/rr/double_definitions/strategies/verification/dont_allow.rb
rr-0.10.4 lib/rr/double_definitions/strategies/verification/dont_allow.rb
rr-0.10.2 lib/rr/double_definitions/strategies/verification/dont_allow.rb