class Ameba::Rule::Lint::SpecFocus
- Ameba::Rule::Lint::SpecFocus
- Ameba::Rule::Base
- Reference
- Object
Overview
Checks if specs are focused.
In specs focus: true is mainly used to focus on a spec
item locally during development. However, if such change
is committed, it silently runs only focused spec on all
other environment, which is undesired.
This is considered bad:
describe MyClass, focus: true do
end
describe ".new", focus: true do
end
context "my context", focus: true do
end
it "works", focus: true do
endAnd it should be written as the following:
describe MyClass do
end
describe ".new" do
end
context "my context" do
end
it "works" do
endYAML configuration example:
Lint/SpecFocus:
  Enabled: trueIncluded Modules
- YAML::Serializable
- YAML::Serializable::Strict
Defined in:
ameba/rule/lint/spec_focus.crConstant Summary
- 
        MSG = "Focused spec item detected"
- 
        SPEC_ITEM_NAMES = ["describe", "context", "it", "pending"] of ::String
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- 
        .new(config = nil)
        
          Checks if specs are focused. 
Instance Method Summary
- #description : String
- #description=(description : String)
- #enabled : Bool
- #enabled=(enabled : Bool)
- #excluded : Array(String) | Nil
- #excluded=(excluded : Array(String) | Nil)
- #severity : Ameba::Severity
- #severity=(severity : Ameba::Severity)
- #test(source, node : Crystal::Call)
- #test(source)
Instance methods inherited from class Ameba::Rule::Base
  
  
    
      ==(other)
    ==, 
    
  
    
      catch(source : Source)
    catch, 
    
  
    
      excluded?(source)
    excluded?, 
    
  
    
      group
    group, 
    
  
    
      hash
    hash, 
    
  
    
      name
    name, 
    
  
    
      special?
    special?, 
    
  
    
      test(source : Source, node : Crystal::ASTNode, *opts)test(source : Source) test
Class methods inherited from class Ameba::Rule::Base
  
  
    
      parsed_doc
    parsed_doc
    
  
  
    
    
    
  
    
    
    
  
    
    
    
  
Constructor Detail
        
        def self.new(config = nil)
        #
      
      
        Checks if specs are focused.
In specs focus: true is mainly used to focus on a spec
item locally during development. However, if such change
is committed, it silently runs only focused spec on all
other environment, which is undesired.
This is considered bad:
describe MyClass, focus: true do
end
describe ".new", focus: true do
end
context "my context", focus: true do
end
it "works", focus: true do
endAnd it should be written as the following:
describe MyClass do
end
describe ".new" do
end
context "my context" do
end
it "works" do
endYAML configuration example:
Lint/SpecFocus:
  Enabled: true