class RuboCop::RSpec::Hook
Wrapper for RSpec hook
Constants
- STANDARDIZED_SCOPES
Public Instance Methods
example?()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 23 def example? scope.equal?(:each) end
knowable_scope?()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 13 def knowable_scope? return true unless scope_argument scope_argument.sym_type? end
name()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 9 def name node.method_name end
scope()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 27 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?()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 19 def valid_scope? STANDARDIZED_SCOPES.include?(scope) end
Private Instance Methods
scope_argument()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 43 def scope_argument node.send_node.first_argument end
scope_name()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 39 def scope_name scope_argument.to_a.first end