Sha256: 04b62b00738c8a0667bd17f7275b272cef58cc96e2141a95758d4e6d080b9a4b

Contents?: true

Size: 986 Bytes

Versions: 3

Compression:

Stored size: 986 Bytes

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
  end

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

  def test_delete_config_file
    path = './test/fixtures'
    key = '7a7096c'
    data = {'github_username' => 'bob', 'key' => key}
    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.4 test/exercism/config_test.rb
exercism-0.0.3 test/exercism/config_test.rb
exercism-0.0.2 test/exercism/config_test.rb