Class: RuboCop::RSpec::Hook
Overview
Constant Summary
Constants included
from Language
Language::ALL
Instance Method Summary
collapse
Methods inherited from Concept
#eql?, #hash, #initialize, #to_node
Instance Method Details
#example? ⇒ Boolean
24
25
26
|
# File 'lib/rubocop/rspec/hook.rb', line 24
def example?
scope.equal?(:each)
end
|
#knowable_scope? ⇒ Boolean
14
15
16
17
18
|
# File 'lib/rubocop/rspec/hook.rb', line 14
def knowable_scope?
return true unless scope_argument
scope_argument.sym_type?
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/rubocop/rspec/hook.rb', line 10
def name
node.method_name
end
|
#scope ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/rubocop/rspec/hook.rb', line 28
def scope
case scope_name
when nil, :each, :example then :each
when :context, :all then :context
when :suite then :suite
else
scope_name
end
end
|
#valid_scope? ⇒ Boolean
20
21
22
|
# File 'lib/rubocop/rspec/hook.rb', line 20
def valid_scope?
STANDARDIZED_SCOPES.include?(scope)
end
|