class Transpec::Syntax::Should
Public Instance Methods
dynamic_analysis_target?()
click to toggle source
Calls superclass method
Transpec::Syntax#dynamic_analysis_target?
# File lib/transpec/syntax/should.rb, line 22 def dynamic_analysis_target? super && receiver_node && [:should, :should_not].include?(method_name) end
expectize!(negative_form = 'not_to')
click to toggle source
# File lib/transpec/syntax/should.rb, line 26 def expectize!(negative_form = 'not_to') fail ContextError.new("##{method_name}", '#expect', selector_range) unless expect_available? if proc_subject? replace(range_of_subject_method_taking_block, 'expect') else wrap_subject_in_expect! end replace(should_range, positive? ? 'to' : negative_form) @current_syntax_type = :expect add_record(RecordBuilder.build(self, negative_form)) end
name_of_subject_method_taking_block()
click to toggle source
# File lib/transpec/syntax/should.rb, line 49 def name_of_subject_method_taking_block range_of_subject_method_taking_block.source end
proc_subject?()
click to toggle source
# File lib/transpec/syntax/should.rb, line 41 def proc_subject? return true if proc_literal?(subject_node) return false unless subject_node.block_type? send_node = subject_node.children.first receiver_node, method_name, = *send_node receiver_node.nil? && method_name == :expect end
Private Instance Methods
expect_available?()
click to toggle source
# File lib/transpec/syntax/should.rb, line 55 def expect_available? syntax_available?(__method__) end
range_of_subject_method_taking_block()
click to toggle source
# File lib/transpec/syntax/should.rb, line 59 def range_of_subject_method_taking_block send_node = subject_node.children.first send_node.loc.expression end