Class: Transpec::Syntax::Have::HaveRecord

Inherits:
Record
  • Object
show all
Defined in:
lib/transpec/syntax/have/have_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Record

#==, #hash, #to_s

Constructor Details

#initialize(have) ⇒ HaveRecord

Returns a new instance of HaveRecord.



11
12
13
# File 'lib/transpec/syntax/have/have_record.rb', line 11

def initialize(have)
  @have = have
end

Instance Attribute Details

#haveObject (readonly)

Returns the value of attribute have.



9
10
11
# File 'lib/transpec/syntax/have/have_record.rb', line 9

def have
  @have
end

Instance Method Details

#annotationObject



31
32
33
34
35
36
37
38
39
# File 'lib/transpec/syntax/have/have_record.rb', line 31

def annotation
  return @annotation if instance_variable_defined?(:@annotation)

  @annotation = if have.accurate_conversion?
                  nil
                else
                  AccuracyAnnotation.new(have.matcher_range)
                end
end

#converted_syntaxObject



23
24
25
26
27
28
29
# File 'lib/transpec/syntax/have/have_record.rb', line 23

def converted_syntax
  @converted_syntax ||= begin
    type = have.expectation.current_syntax_type
    syntax = build_expectation(converted_subject, type)
    syntax << " #{source_builder.replacement_matcher_source}"
  end
end

#original_syntaxObject



15
16
17
18
19
20
21
# File 'lib/transpec/syntax/have/have_record.rb', line 15

def original_syntax
  @original_syntax ||= begin
    type = have.expectation.class.snake_case_name.to_sym
    syntax = build_expectation(original_subject, type)
    syntax << " #{have.method_name}(n).#{original_items}"
  end
end