Module: Transpec::Syntax::Mixin::HaveMatcherOwner

Included in:
Expect, OnelinerShould, Should
Defined in:
lib/transpec/syntax/mixin/have_matcher_owner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(syntax) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/transpec/syntax/mixin/have_matcher_owner.rb', line 9

def self.included(syntax)
  syntax.add_dynamic_analysis_request do |rewriter|
    if Have.dynamic_analysis_target_node?(matcher_node)
      create_have_matcher.register_request_for_dynamic_analysis(rewriter)
    end
  end
end

Instance Method Details

#have_matcherObject

rubocop:disable PredicateName



17
18
19
20
21
22
23
24
25
# File 'lib/transpec/syntax/mixin/have_matcher_owner.rb', line 17

def have_matcher # rubocop:disable PredicateName
  return @have_matcher if instance_variable_defined?(:@have_matcher)

  @have_matcher ||= if Have.conversion_target_node?(matcher_node, @runtime_data)
                      create_have_matcher
                    else
                      nil
                    end
end