File: child_double_definition_create.rb

package info (click to toggle)
ruby-rr 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,424 kB
  • sloc: ruby: 11,405; makefile: 7
file content (28 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module RR
  module DoubleDefinitions
    class ChildDoubleDefinitionCreate < DoubleDefinitionCreate # :nodoc
      attr_reader :parent_double_definition

      def initialize(parent_double_definition)
        @parent_double_definition = parent_double_definition
        super()
      end

      def root_subject
        parent_double_definition.root_subject
      end

      def instance_of(*args)
        raise NoMethodError
      end

    protected
      def add_strategy(subject, method_name, definition_eval_block, &block)
        super do
          block.call
          parent_double_definition.implemented_by(lambda {|*args| subject })
        end
      end
    end
  end
end