Module: TestChanges::ConfigSetupService

Defined in:
lib/test_changes/config_setup_service.rb

Class Method Summary collapse

Class Method Details

.callObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/test_changes/config_setup_service.rb', line 3

def self.call
  config_file_name = '.test-changes.yml'
  config = Config.new(config_file_name)

  return config if config.exists?

  if File.exist?('./config/application.rb')
    return use_rspec_rails('./bin/rspec') if File.exist?('./bin/rspec')
    return use_rspec_rails('bundle exec rspec') if File.directory?('./spec')
    return use_testunit_rails('bundle exec ruby -Itest') if File.directory?('./test')
  end

  fail TestChanges::Error, "No #{config_file_name} found"
end