Sha256: fac37c732cc7ee859f6f67a6db3ea3257852d7f0adb9a22ccb399e9166636b67

Contents?: true

Size: 988 Bytes

Versions: 4

Compression:

Stored size: 988 Bytes

Contents

require './test/test_helper'

class ExercismTest < MiniTest::Unit::TestCase

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

  def test_logged_in_user
    Exercism.stub(:home, './test/fixtures/home') do
      user = Exercism.user
      key = '634abfb095ed621e1c793c9875fcd9fda455ea90'
      assert_equal 'alice', user.github_username
      assert_equal key, user.key
    end
  end

  def test_login_gives_you_a_user
    Exercism.stub(:home, './test/fixtures') do
      key = '97e9975'
      user = Exercism.login('bob', key, '/dev/null')
      assert_equal 'bob', user.github_username
      assert_equal key, user.key
    end
  end

  def test_login_writes_the_config_file
    Exercism.stub(:home, './test/fixtures') do
      key = '97e9975'
      Exercism.login('bob', key, '/tmp')
      user = Exercism.user
      assert_equal 'bob', user.github_username
      assert_equal key, user.key
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exercism-0.0.8 test/exercism_test.rb
exercism-0.0.7 test/exercism_test.rb
exercism-0.0.6 test/exercism_test.rb
exercism-0.0.5 test/exercism_test.rb