Sha256: 1552a518fe0fee9282dcd16360180e9773f0b9f5860bd43fa55f7af73bb802b7

Contents?: true

Size: 1.05 KB

Versions: 36

Compression:

Stored size: 1.05 KB

Contents

require_relative '../test_helper'

module OhlohScm::Adapters
	class GitTokenTest < OhlohScm::Test

		def test_no_token_returns_nil
			OhlohScm::ScratchDir.new do |dir|
				git = GitAdapter.new(:url => dir).normalize
				assert !git.read_token
				git.init_db
				assert !git.read_token
			end
		end

		def test_write_and_read_token
			OhlohScm::ScratchDir.new do |dir|
				git = GitAdapter.new(:url => dir).normalize
				git.init_db
				git.write_token("FOO")
				assert !git.read_token # Token not valid until committed
				git.commit_all(OhlohScm::Commit.new)
				assert_equal "FOO", git.read_token
			end
		end

		def test_commit_all_includes_write_token
			OhlohScm::ScratchDir.new do |dir|
				git = GitAdapter.new(:url => dir).normalize
				git.init_db
				c = OhlohScm::Commit.new
				c.token = "BAR"
				git.commit_all(c)
				assert_equal c.token, git.read_token
			end
		end

    def test_read_token_encoding
      with_git_repository('git_with_invalid_encoding') do |git|
        assert_nothing_raised do
          git.read_token
        end
      end
    end
	end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ohloh_scm-2.5.1 test/unit/git_token_test.rb
ohloh_scm-2.4.14 test/unit/git_token_test.rb
ohloh_scm-2.4.13 test/unit/git_token_test.rb
ohloh_scm-2.4.12 test/unit/git_token_test.rb
ohloh_scm-2.4.11 test/unit/git_token_test.rb
ohloh_scm-2.4.10 test/unit/git_token_test.rb
ohloh_scm-2.4.9 test/unit/git_token_test.rb
ohloh_scm-2.4.8 test/unit/git_token_test.rb
ohloh_scm-2.4.7 test/unit/git_token_test.rb
ohloh_scm-2.4.6 test/unit/git_token_test.rb
ohloh_scm-2.4.5 test/unit/git_token_test.rb
ohloh_scm-2.4.4 test/unit/git_token_test.rb
ohloh_scm-2.4.3 test/unit/git_token_test.rb
ohloh_scm-2.4.1 test/unit/git_token_test.rb
ohloh_scm-2.4.0 test/unit/git_token_test.rb
ohloh_scm-2.3.5 test/unit/git_token_test.rb
ohloh_scm-2.3.4 test/unit/git_token_test.rb
ohloh_scm-2.3.2 test/unit/git_token_test.rb
ohloh_scm-2.3.1 test/unit/git_token_test.rb
ohloh_scm-2.3.0 test/unit/git_token_test.rb