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 24 def example? scope.equal?(:each) end
knowable_scope?()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 14 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 10 def name node.method_name end
scope()
click to toggle source
# 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?()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 20 def valid_scope? STANDARDIZED_SCOPES.include?(scope) end
Private Instance Methods
scope_argument()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 44 def scope_argument node.send_node.first_argument end
scope_name()
click to toggle source
# File lib/rubocop/rspec/hook.rb, line 40 def scope_name scope_argument.to_a.first end