Sha256: 48013beb64127171bd065e67ae3d782a12d5322e4bcf708767cc3279338ceb7d

Contents?: true

Size: 1.78 KB

Versions: 25

Compression:

Stored size: 1.78 KB

Contents

module RR
  module DoubleDefinitions
    module Strategies
      module StrategyMethods
        extend(Module.new do
          def lately_bound_alias_method(target_method_name, source_method_name)
            module_eval(<<-METHOD, __FILE__, __LINE__+1)
              def #{target_method_name}(*args, &block)
                #{source_method_name}(*args, &block)
              end
            METHOD
          end
        end)

        def mock!(method_name=nil, &definition_eval_block)
          mock(Object.new, method_name, &definition_eval_block)
        end

        def stub!(method_name=nil, &definition_eval_block)
          stub(Object.new, method_name, &definition_eval_block)
        end

        def dont_allow!(method_name=nil, &definition_eval_block)
          dont_allow(Object.new, method_name, &definition_eval_block)
        end
        lately_bound_alias_method :do_not_allow, :dont_allow
        lately_bound_alias_method :do_not_allow!, :dont_allow!

        def proxy!(method_name=nil, &definition_eval_block)
          proxy(Object.new, method_name, &definition_eval_block)
        end
        lately_bound_alias_method :probe, :proxy
        lately_bound_alias_method :probe!, :proxy!

        def strong!(method_name=nil, &definition_eval_block)
          strong(Object.new, method_name, &definition_eval_block)
        end

        def any_instance_of!(method_name=nil, &definition_eval_block)
          any_instance_of(Object.new, method_name, &definition_eval_block)
        end

        def instance_of!(method_name=nil, &definition_eval_block)
          instance_of(Object.new, method_name, &definition_eval_block)
        end
        lately_bound_alias_method :all_instances_of, :instance_of
        lately_bound_alias_method :all_instances_of!, :instance_of!
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rr-3.1.1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.1.0 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.9 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.8 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.7 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.6 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.5 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.4 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.3 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.2 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-3.0.0 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.2.1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.2.0 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.2 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.2.rc1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.1.rc1 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.0 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.1.0.rc3 lib/rr/double_definitions/strategies/strategy_methods.rb