Sha256: c784cf18df9853c039bf9e7ddd77a6070e94873d015737230456bb655cfcd904

Contents?: true

Size: 1.91 KB

Versions: 22

Compression:

Stored size: 1.91 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
        lately_bound_alias_method :all_instances_of, :any_instance_of
        lately_bound_alias_method :all_instances_of!, :any_instance_of!

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

Version data entries

22 entries across 18 versions & 5 rubygems

Version Path
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
bitclust-core-0.5.1 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/lib/rr/double_definitions/strategies/strategy_methods.rb
mcmire-rr-1.0.5.rc1 lib/rr/double_definitions/strategies/strategy_methods.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.0.4 lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.0.3 lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rr-1.0.2/lib/rr/double_definitions/strategies/strategy_methods.rb
rr-1.0.2 lib/rr/double_definitions/strategies/strategy_methods.rb