Class: TestDiff::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/test_diff/config.rb

Overview

Holds all the configuration details

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
17
# File 'lib/test_diff/config.rb', line 12

def initialize
  self.working_directory = '.'
  self.map_subfolder = 'test_diff_coverage'
  self.current_tracking_filename = 'sha'
  self.test_pattern = /spec.rb\z/
end

Instance Attribute Details

#current_tracking_filenameObject

Returns the value of attribute current_tracking_filename.



7
8
9
# File 'lib/test_diff/config.rb', line 7

def current_tracking_filename
  @current_tracking_filename
end

#map_subfolderObject

Returns the value of attribute map_subfolder.



7
8
9
# File 'lib/test_diff/config.rb', line 7

def map_subfolder
  @map_subfolder
end

#storageObject



24
25
26
# File 'lib/test_diff/config.rb', line 24

def storage
  @storage ||= Storage.new(map_folder)
end

#test_patternObject

Returns the value of attribute test_pattern.



7
8
9
# File 'lib/test_diff/config.rb', line 7

def test_pattern
  @test_pattern
end

#test_runnerObject



28
29
30
# File 'lib/test_diff/config.rb', line 28

def test_runner
  @test_runner ||= TestRunner::Rspec.new
end

#version_controlObject



19
20
21
22
# File 'lib/test_diff/config.rb', line 19

def version_control
  @version_control ||= VersionControl::Git.new(working_directory,
                                               File.read(current_tracking_file))
end

#working_directoryObject

Returns the value of attribute working_directory.



7
8
9
# File 'lib/test_diff/config.rb', line 7

def working_directory
  @working_directory
end

Class Method Details

.method_missing(method, *args) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/test_diff/config.rb', line 40

def self.method_missing(method, *args)
  if instance.respond_to?(method)
    instance.send(method, *args)
  else
    super
  end
end

Instance Method Details

#current_tracking_fileObject



36
37
38
# File 'lib/test_diff/config.rb', line 36

def current_tracking_file
  "#{map_folder}/#{current_tracking_filename}"
end

#map_folderObject



32
33
34
# File 'lib/test_diff/config.rb', line 32

def map_folder
  "#{working_directory}/#{map_subfolder}"
end