Sha256: 226d790fb581078f28a3293dfc7848e3fde6d403d375583fabdf9c739ddea05e

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require "test_helper"

class ConfigTest < Rugged::TestCase 
  include Rugged::RepositoryAccess

  def test_read_config_file
    config = @repo.config
    assert_equal 'false', config['core.bare']
    assert_nil config['not.exist']
  end

  def test_read_config_from_path
    config = Rugged::Config.new(File.join(@repo.path, 'config'))
    assert_equal 'false', config['core.bare']
  end

  def test_read_global_config_file
    config = Rugged::Config.global
    assert config['user.name'] != nil
    assert_nil config['core.bare']
  end
end

class ConfigWriteTest < Rugged::TestCase
  include Rugged::TempRepositoryAccess

  def test_write_config_values
    config = @repo.config
    config['custom.value'] = 'my value'

    config2 = @repo.config
    assert_equal 'my value', config2['custom.value']

    content = File.read(File.join(@repo.path, 'config'))
    assert_match(/value = my value/, content)
  end

  def test_delete_config_values
    config = @repo.config
    config.delete('core.bare')

    config2 = @repo.config
    assert_nil config2.get('core.bare')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rugged-0.19.0 test/config_test.rb
rugged-0.18.0.gh.de28323 test/config_test.rb
rugged-0.18.0.b1 test/config_test.rb