Class: Mutante::Configuration
- Inherits:
-
Object
- Object
- Mutante::Configuration
- Defined in:
- lib/mutante/configuration.rb
Constant Summary collapse
- DEFAULT_RAILS_GLOBS =
%w[ app/models/**/*.rb app/controllers/**/*.rb app/services/**/*.rb app/jobs/**/*.rb app/mailers/**/*.rb app/helpers/**/*.rb app/channels/**/*.rb app/serializers/**/*.rb lib/**/*.rb ].freeze
- DEFAULT_EXCLUDE_GLOBS =
%w[ spec/**/* test/**/* config/**/* db/**/* vendor/**/* tmp/**/* ].freeze
Instance Attribute Summary collapse
-
#exclude_globs ⇒ Object
Returns the value of attribute exclude_globs.
-
#include_globs ⇒ Object
Returns the value of attribute include_globs.
-
#root ⇒ Object
Returns the value of attribute root.
-
#test_command ⇒ Object
Returns the value of attribute test_command.
-
#test_mappings ⇒ Object
Returns the value of attribute test_mappings.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#map(source_glob, to:) ⇒ Object
Map a source-file glob to the spec file(s) that cover it.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
30 31 32 33 34 35 36 |
# File 'lib/mutante/configuration.rb', line 30 def initialize @include_globs = DEFAULT_RAILS_GLOBS.dup @exclude_globs = DEFAULT_EXCLUDE_GLOBS.dup @test_command = default_test_command @test_mappings = {} @root = Dir.pwd end |
Instance Attribute Details
#exclude_globs ⇒ Object
Returns the value of attribute exclude_globs.
24 25 26 |
# File 'lib/mutante/configuration.rb', line 24 def exclude_globs @exclude_globs end |
#include_globs ⇒ Object
Returns the value of attribute include_globs.
24 25 26 |
# File 'lib/mutante/configuration.rb', line 24 def include_globs @include_globs end |
#root ⇒ Object
Returns the value of attribute root.
24 25 26 |
# File 'lib/mutante/configuration.rb', line 24 def root @root end |
#test_command ⇒ Object
Returns the value of attribute test_command.
24 25 26 |
# File 'lib/mutante/configuration.rb', line 24 def test_command @test_command end |
#test_mappings ⇒ Object
Returns the value of attribute test_mappings.
24 25 26 |
# File 'lib/mutante/configuration.rb', line 24 def test_mappings @test_mappings end |
Instance Method Details
#map(source_glob, to:) ⇒ Object
Map a source-file glob to the spec file(s) that cover it.
config.map "app/services/**/*.rb", to: "spec/services/{basename}_spec.rb"
Placeholders in the target:
{basename} - file name without extension
{relative} - path relative to app/ or lib/
{relative_dir} - directory part of {relative}
46 47 48 |
# File 'lib/mutante/configuration.rb', line 46 def map(source_glob, to:) test_mappings[source_glob] = to end |