Sha256: 96c04cb1351213fa200f36db29f716f9d15830aee10cff7475f0ec7f9d8e5b35

Contents?: true

Size: 1.83 KB

Versions: 36

Compression:

Stored size: 1.83 KB

Contents

require_relative '../test_helper'

module OhlohScm::Adapters
	class FactoryTest < OhlohScm::Test

		def test_factory_hg
			OhlohScm::ScratchDir.new do |path|
				`cd #{path} && hg init`
				hg = Factory.from_path(path)
				assert hg.is_a?(HgAdapter)
				assert_equal hg.url, path
			end
		end

		def test_factory_bzr
			OhlohScm::ScratchDir.new do |path|
				`cd #{path} && bzr init`
				bzr = Factory.from_path(path)
				assert bzr.is_a?(BzrAdapter)
				assert_equal bzr.url, path
			end
		end

		def test_factory_git
			OhlohScm::ScratchDir.new do |path|
				`cd #{path} && git init`
				git = Factory.from_path(path)
				assert git.is_a?(GitAdapter)
				assert_equal git.url, path
			end
		end

		def test_factory_svn
			OhlohScm::ScratchDir.new do |path|
				`cd #{path} && svnadmin create foo`
				svn = Factory.from_path(File.join(path, 'foo'))
				assert svn.is_a?(SvnAdapter)
				assert_equal svn.url, 'file://' + File.expand_path(File.join(path, 'foo'))
			end
		end

		def test_factory_svn_checkout
			OhlohScm::ScratchDir.new do |path|
				`cd #{path} && svnadmin create foo`
				`cd #{path} && svn co file://#{File.expand_path(File.join(path, 'foo'))} bar`
				svn = Factory.from_path(File.join(path, 'bar'))
				assert svn.is_a?(SvnAdapter)
				# Note that even though we gave checkout dir 'bar' to the factory,
				# we get back a link to the original repo at 'foo'
				assert_equal svn.url, 'file://' + File.expand_path(File.join(path, 'foo'))
			end
		end

		def test_factory_from_cvs_checkout
			with_cvs_repository('cvs', 'simple') do |cvs|
				OhlohScm::ScratchDir.new do |path|
					`cd #{path} && cvsnt -d #{File.expand_path(cvs.url)} co simple 2> /dev/null`
					factory_response = Factory.from_path(File.join(path, 'simple'))
					assert factory_response.is_a?(CvsAdapter)
					assert_equal cvs.url, factory_response.url
				end
			end
		end

	end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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