Class: ConfigTest

Inherits:
MiniTest::Unit::TestCase
  • Object
show all
Defined in:
lib/gitdummy/tests/config_test.rb

Instance Method Summary collapse

Instance Method Details

#test_default_trackingObject



27
28
29
30
31
32
# File 'lib/gitdummy/tests/config_test.rb', line 27

def test_default_tracking
  push_default = $repo.config['push.default']

  assert_equal 'tracking', push_default,
    "Please correct you push.default configuration with `git config push.default tracking`. `#{push_default} no accepted."
end

#test_user_emailObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/gitdummy/tests/config_test.rb', line 16

def test_user_email
  email = $repo.config['user.email'].force_encoding('utf-8')

  # load configurable regexp to test the user's email
  #
  regexp = Regexp.new($config['tests']['config']['user']['email_regexp'].force_encoding('utf-8'))

  assert_match regexp || /^[a-z]+\.[a-z]+@\w+\.\w+$/, email,
    "Please correct your user.email configuration with e.g. `git config user.email '[email protected]'`. `#{email}` not accepted"
end

#test_user_nameObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/gitdummy/tests/config_test.rb', line 5

def test_user_name
  name = $repo.config['user.name'].force_encoding('utf-8')

  # load configurable regexp to test the user's email
  #
  regexp = Regexp.new($config['tests']['config']['user']['name_regexp'].force_encoding('utf-8'))

  assert_match regexp || /^\w+ \w+$/i, name,
    "Please correct your user.name configuration with e.g. `git config user.name 'John Doe'`. `#{name}` not accepted"
end