Sha256: 3706b2b76f1319e1d071df02d1d16526fc4d3d3683679da477b7cda7441815b9

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require './test/test_helper'

class ConfigTest < MiniTest::Unit::TestCase

  def teardown
    if File.exists?('./test/fixtures/.exercism')
      FileUtils.rm('./test/fixtures/.exercism')
    end
  end

  def test_read_config_file
    path = './test/fixtures/home'
    key = '634abfb095ed621e1c793c9875fcd9fda455ea90'
    config = Exercism::Config.read(path)
    assert_equal 'alice', config.github_username
    assert_equal key, config.key
    assert_equal '/tmp', config.project_dir
  end

  def test_write_config_file
    path = './test/fixtures'
    key = '7a7096c'
    data = {
      'github_username' => 'bob',
      'key' => key,
      'project_dir' => '/dev/null'
    }
    config = Exercism::Config.write(path, data)
    assert_equal 'bob', config.github_username
    assert_equal key, config.key
    assert_equal '/dev/null', config.project_dir
  end

  def test_delete_config_file
    path = './test/fixtures'
    key = '7a7096c'
    data = {
      'github_username' => 'bob',
      'key' => key,
      'project_dir' => '/tmp'
    }
    config = Exercism::Config.write(path, data)
    filename = config.file
    config.delete
    assert !File.exists?(filename)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exercism-0.0.7 test/exercism/config_test.rb
exercism-0.0.6 test/exercism/config_test.rb
exercism-0.0.5 test/exercism/config_test.rb