Sha256: e2431fe599b031d043de9049dd3830ea161827be7499f28aaf9db52b78013a1b

Contents?: true

Size: 973 Bytes

Versions: 6

Compression:

Stored size: 973 Bytes

Contents

require './test/test_helper'

class ExercismTest < Minitest::Test

  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, '/tmp')
      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

6 entries across 6 versions & 1 rubygems

Version Path
exercism-0.0.18 test/exercism_test.rb
exercism-0.0.17 test/exercism_test.rb
exercism-0.0.16 test/exercism_test.rb
exercism-0.0.15 test/exercism_test.rb
exercism-0.0.14 test/exercism_test.rb
exercism-0.0.13 test/exercism_test.rb