class RuboCop::Cop::RSpec::ExampleLength
end # 5 points
HEREDOC
content.
Heredoc
msg = <<~HEREDOC # +1
}
key: ‘value’
hash = { # +3
]
2
1,
array = [ # +1
it do
@example CountAsOne: [‘array’, ‘heredoc’]
will be counted as one line regardless of its actual size.
Available are: ‘array’, ‘hash’, and ‘heredoc’. Each literal
You can set literals you want to fold with ‘CountAsOne`.
end
expect(result).to be(true)
result = service.call
service = described_class.new
it do
# good
end
expect(result).to be(true)
result = service.call
more_setup
more_setup
service = described_class.new
it do
# bad
@example
method.
extracting out some behavior, e.g. with a `let` block, or a helper
A long example is usually more difficult to understand. Consider
Checks for long examples.
def cop_label
def cop_label LABEL end
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) check_code_length(node) end