Class: TestMap::NaturalMapping::CommonRule
- Inherits:
-
Struct
- Object
- Struct
- TestMap::NaturalMapping::CommonRule
- Defined in:
- lib/test_map/natural_mapping.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
9 10 11 |
# File 'lib/test_map/natural_mapping.rb', line 9 def file @file end |
Class Method Details
.call(file) ⇒ Object
10 |
# File 'lib/test_map/natural_mapping.rb', line 10 def self.call(file) = new(file).call |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/test_map/natural_mapping.rb', line 12 def call if File.exist?('test') transform('test') elsif File.exist?('spec') transform('spec') end end |
#transform(type) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/test_map/natural_mapping.rb', line 20 def transform(type) test_file = "#{File.basename(file, '.rb')}_#{type}.rb" test_path = File.dirname(file).sub('app/', '') test_path = nil if test_path == '.' [type, test_path, test_file].compact.join('/') end |