Class: PolishGeeks::DevTools::Commands::RspecFilesStructure
- Defined in:
- lib/polish_geeks/dev_tools/commands/rspec_files_structure.rb
Overview
Checks if there are are rb files that don’t have corresponding rspec spec files defined This will validate that the names are the same (no typos, etc) and no file are without spec files (even just with pending)
Constant Summary collapse
- FILES_CHECKED =
Files in directories that we want to check against their rspec corresponding files
%w( app/**/*.rb lib/**/*.rb ).freeze
- RSPEC_FILES =
From where should we take spec files
%w( spec/**/*_spec.rb ).freeze
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#error_message ⇒ String
Error message that will be displayed if something goes wrong.
-
#execute ⇒ Array<String>
Executes this command.
-
#label ⇒ String
Label with this validator description.
-
#valid? ⇒ Boolean
True if everything is ok and all the files have rspec corresponding files.
Methods inherited from Base
Instance Method Details
#error_message ⇒ String
Returns error message that will be displayed if something goes wrong.
46 47 48 49 |
# File 'lib/polish_geeks/dev_tools/commands/rspec_files_structure.rb', line 46 def err = + err end |
#execute ⇒ Array<String>
Executes this command
26 27 28 29 30 31 |
# File 'lib/polish_geeks/dev_tools/commands/rspec_files_structure.rb', line 26 def execute @output = { app: analyzed_files - analyzed_rspec_files, rspec: analyzed_rspec_files - analyzed_files } end |
#label ⇒ String
Returns label with this validator description.
40 41 42 |
# File 'lib/polish_geeks/dev_tools/commands/rspec_files_structure.rb', line 40 def label "Rspec files structure (#{analyzed_files.count} checked)" end |
#valid? ⇒ Boolean
Returns true if everything is ok and all the files have rspec corresponding files.
35 36 37 |
# File 'lib/polish_geeks/dev_tools/commands/rspec_files_structure.rb', line 35 def valid? @output[:app].empty? && @output[:rspec].empty? end |