Sha256: 52d0b96f41cdc7c7e74246ab92522946f6c0f98cd95a57cf373253a4a5ed8588

Contents?: true

Size: 967 Bytes

Versions: 3

Compression:

Stored size: 967 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)
      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)
      user = Exercism.user
      assert_equal 'bob', user.github_username
      assert_equal key, user.key
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exercism-0.0.4 test/exercism_test.rb
exercism-0.0.3 test/exercism_test.rb
exercism-0.0.2 test/exercism_test.rb