Method: Transpec::Converter#process_oneliner_should

Defined in:
lib/transpec/converter.rb

#process_oneliner_should(oneliner_should) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/transpec/converter.rb', line 60

def process_oneliner_should(oneliner_should)
  negative_form = configuration.negative_form_of_to
  parenthesize = configuration.parenthesize_matcher_arg?

  # TODO: Referencing oneliner_should.have_matcher.project_requires_collection_matcher?
  #   from this converter is considered bad design.
  should_convert_have_items = configuration.convert_have_items? &&
                              oneliner_should.have_matcher &&
                              !oneliner_should.have_matcher.project_requires_collection_matcher?

  if should_convert_have_items
    if configuration.convert_should?
      oneliner_should.convert_have_items_to_standard_expect!(negative_form, parenthesize)
    else
      oneliner_should.convert_have_items_to_standard_should!
    end
  elsif configuration.convert_oneliner? && rspec_version.oneliner_is_expected_available?
    oneliner_should.expectize!(negative_form, parenthesize)
  end

  process_raise_error(oneliner_should.raise_error_matcher)
end